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]
3 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]3 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
Steve left his computer switched on in his room and went out to have breakfast. When he returned, he saw that the monitor had be
yanalaym [24]

Answer:

B

Explanation:

5 0
3 years ago
Assume we have a two-class learning problem where the labeled data consists of 1,000 data points from one class, and 10 data poi
lakkis [162]

Answer:

I don't know

Explanation:

please just thank me I need the points

4 0
4 years ago
A business that subscribes to a specific computing model has its entire system fully functional within a short time. What benefi
defon

Its quick development

Quick deployment: When a business opts for cloud computing and subscribes to a specific model, its entire system can be fully functional within a short time—even within a few minutes. The amount of time depends on the kind of technology and the business’s computing needs.


7 0
3 years ago
How to add links in HTML? ​
saveliy_v [14]

Answer:

<a href="url">link text</a>

6 0
2 years ago
To set up a slide show you should do all of the following except ______.
Harlamova29_29 [7]
To set up a slide show you should do all of the following except exit without saving
5 0
4 years ago
Other questions:
  • You are part of a testing team at a software business. Your job is to see how many concurrent users the system can host and how
    7·1 answer
  • A professor is working with five teams in his marketing research class. He decides to experiment with path-goal theory in helpin
    11·1 answer
  • Given the variable ip, already declared as a pointer to an integer, write the code to dynamically allocate memory for a single i
    15·1 answer
  • A file with a .bat file extension is called a batch file. You can use a batch file to execute a group of commands, sometimes cal
    11·1 answer
  • The ELECTRONIC COMMUNICATIONS PRIVACY ACT prohibits unauthorized eavesdropping by all persons, businesses, and the government.
    5·1 answer
  • How to count how many uppercase letters in sentence in python?
    8·1 answer
  • Intellectual property rights are exclusive rights that help protect both the created and the creation. IPR offers exclusively wh
    8·2 answers
  • A professional photographer working for a top newspaper would like control over the quality and editing
    14·2 answers
  • Name 3 supercomputers along with their cost, purpose and the country it is located.​
    15·1 answer
  • Unscramble dki-----------------------------------------------------------------------...........
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!