1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tensa zangetsu [6.8K]
2 years ago
15

g Create a program that reads a list of states from an input file, puts them in order, and displays the sorted list to the user.

Description Read in a list of states from a file, and output those states in alphabetical order. Provided input files A single input file named states.txt is provided that lists states of the United States - one state per row. Some states have lowercase letters, where some begin with uppercase letters. As a reminder, lowercase letters come after uppercase letters alphabetically. The states are in a random order. The file has the following format: Michigan california New Mexico Texas nevada ... Objectives Write the following in main.py: Open the states.txt file. Create a list called ‘states’ where each element in the list is one of the states read from the file. Do not change the text that is read from the file. Print to the user (not to a file) an alphabetized list of all the states, with one state per line. For example, Alabama Alaska Arizona ... Note: You will lose points if you do not correctly work with the file. If you decide to just use a print statement to display the output, without using file input, and pass the test case with 100%, you will eventually lose points. This program will be checked after the deadline. In short, do not try to cheat the system by simply displaying the list of states.
Computers and Technology
1 answer:
mixas84 [53]2 years ago
3 0

Answer:

Check the explanation

Explanation:

# Step 1

the first thing to execute will be......

f = open("states.txt")

# Step 2

the second step is......

states = []

for line in f:

   states.append(line.strip())

# Step 3:

the third step is to......

for state in sorted(states):

   print(state)

f.close()

You might be interested in
__________ is a computer tool for evaluating the risk of exposure to wildfires.
Brut [27]

Answer:

The statement is true

Explanation:

5 0
1 year ago
Read 2 more answers
Rank these three account types in order of decreasing liquidity. Start by picking the most liquid account type first
Ghella [55]
As there are no options given, I will simply mention the three most liquid accounts in order:

<span>1. Checking Account
2. Savings Account
3. Money Market Deposit Account

Account liquidity refers to the ease and comfort with which you can take your money out of an account from a bank, there are various bank accounts which can be referred to as liquid assets.</span>
5 0
3 years ago
Read 2 more answers
Which button do you click to add up a series of numbers
UNO [17]
It’s autosum



Explanation
5 0
3 years ago
All of the following are ways to save money on transportation except :
Lisa [10]
The options listed are not related to the question. and if they were related in any sense then I would say the cheapest thing on the list is a phone card so I guess you can buy that and save the most for your travel as you can use phone cards anywhere as they have 1800 numbers which are free from any public phone. 
7 0
3 years ago
Which is an example of a Boolean operator that evaluates as TRUE?
ladessa [460]

The expression NOT (3+2=7) evaluates as TRUE because is is NOT the case that 3+2=7.

Let me know if you have any questions.

4 0
2 years ago
Other questions:
  • In the ____________________ technique, the virus is divided into several parts and the parts are placed at random positions thro
    7·1 answer
  • How many valence electrons are present in the atom of the atomic number of 12?
    10·1 answer
  • Which of the following statements best compares and contrasts the role of story writers and script writers
    12·1 answer
  • Select one of the following strategies: active listening, sandwich technique, constructive feedback. in 2-5 paragraphs, define a
    11·1 answer
  • Which of the follow will happen if you miss a monthly credit card payment?
    11·1 answer
  • Javier develops sophisticated fashion websites. He has been asked by the owner of a leading fashion brand to create web content
    13·1 answer
  • Write a program that prompts the user to enter a grade, which is aninteger in the range of 0 - 100. Using if statements, have th
    11·1 answer
  • Which person would be the best fit for a career in the Information Technology field?
    6·2 answers
  • What key value does Accenture’s myConcerto bring to clients looking for automated solutions?
    6·1 answer
  • File names should be limited to 144 characters.<br><br> true or false
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!