The file SomeStates.txt initially contains the names of all 50 U.S. states. Write a program that deletes those states from the file that do not begin with a vowel.
Please solve this in python. Thank you
try:
lines = []
with open("SomeStates.txt") as f:
for line in f:
lines.append(line.strip())
with open("SomeStates.txt", "w") as f:
for line in lines:
if line[0].lower() in "aeiou":
f.write(line + "\n")
except FileNotFoundError:
print("SomeStates.txt does not exists!")
The file SomeStates.txt initially contains the names of all 50 U.S. states. Write a program that...
THIS IS A PROGRAM FOR PYTHON THIS IS A PROGRAM FOR PYTHON THIS IS A PROGRAM FOR PYTHON This time, we will write a program that uses functions to parse through all those names in a List object (see below for the "us_counties" list) to count the number of occurrences each vowel (a, e, i, o, u) has in all the names. We want 5 separate answers, one for each vowel. Not looking for output here. All my solution will...
Write a PYTHON program that asks the user for the name of the file. The program should write the contents of this input file to an output file. In the output file, each line should be preceded with a line number followed by a colon. The output file will have the same name as the input filename, preceded by “ln” (for linenumbers). Be sure to use Try/except to catch all exceptions. For example, when prompted, if the user specifies “sampleprogram.py”...
c++ only help, thank you.
Using the MOCK_DATA.csv file which contains names and scores, write a program that reads the data into a map (string, int). Once the data is in a map, ask the user to enter a name. Look for the name in the map and print the score (if it exists).
The file Senate113.txt contains the members of the 113th U.S. Senate— that is, the Senate prior to the November 2014 election. Each record of the file consists 3 ofthreefields—name,state,andpartyaffiliation. Somerecordsinthefileareasfollows: Richard Shelby,Alabama,R Bernard Sanders,Vermont,I Kristen Gillibrand,New York,D The file RetiredSen.txt contains the records from the file Senate113.txt for senators who left the Senate after the November 2014 election due to retirement, defeat, death, or resignation. Some records in the file are as follows: John Rockefeller,West Virginia,D Tom Coburn,Oklahoma,R Carl Levin,Michigan,D...
Python • Write a program that asks for the names of all of the classes you are taking this semester • Save these class names in a list • Print all the items in the list, one per line
Java console-based question. Do not use BufferedReader please. A file named customers.txt contains the names of customers for a local hairdressing salon. Unfortunately, the data in the file is in no particular order yet the owner of the salon would like the data in alphabetical order. Write a Java program that reads the contents of the file into an array of Strings, sorts the array of Strings into alphabetical order, and then writes the content of the array to a...
PYTHON: 14.7 LAB: All permutations of names PLEASE ANSWER IN PYTHON Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names, then use a recursive method to create and output all possible orderings of those names, one ordering per line. NAES MUST BE ALPHABETICAL ORDER AS IN THE EXAMPLE When the input is: Julia Lucas Mia then the output...
Please answer using C++
The file lab10movies.cpp contains a program that allows the user to read movie names and movie release dates from a file called movies.txt. The data is read into a single ended linked list. Once all the data has been read in, the user is given a menu option with 3 choices. Choice 1 will list all movies released before a specified year, Choice 2 will list all movies stored in the linked list, and Choice 3...
write a python program that reads in the CSV file and
produces a file with just the state names and population from the
web site https://www.census.gov/popest/data/datasets.html
45% 6:39 AM
Write a program that reads in a text file, infile.txt, and prints out all the lines in the file to the screen until it encounters a line with fewer than 4 characters. Once it finds a short line (one with fewer than 4 characters), the program stops. For your testing you should create a file named infile.txt. Only upload your Python program, I will create my own infile.txt. Please use a while-loop BUT do not use break, Exit or Quit...