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
What does the windows update feature allow you to do?
Mariulka [41]
The answer is D
Explanation: none
3 0
3 years ago
Read 2 more answers
How many years does it take in total to complete Bachelor’s, Master’s, and Phd in CS?
muminat

Answer:

3 years of study - Bachelor's degree

2 years of research - Master's degree

3 years of research to earn a PhD

So, On total it would take 8 years!

7 0
3 years ago
Zenmap's topology tab displays a __________ that shows the relative size and connection type of all discovered ip hosts.
VladimirAG [237]
<span>Zenmap's topology tab displays a "Bubble Chart" that shows the relative size and connection type of all discovered IP hosts.
</span>A kind of chart which shows three dimensional data is known as Bubble chart. It also can be seen as the variation of scatter plot where bubbles replace the data points.
4 0
3 years ago
Simple measurement questions, I'm on #5 right now but if you know any other ones that would be helpful (picture)
dangina [55]

Answer:

one inch=25.4

12 meters=13.12

10 quarts=9.46

12 milliliters=0.0004

400 pounds= 181 kg

25 meters/second=82

68F=20C

Explanation:

heres the full ones

one inch=25.4

12 meters=13.1234 yards

10 quarts=9.46353

12 milliliters=0.000405768

400 pounds=181.437

25m/s=82.021f/s

68f=20C

7 0
3 years ago
Mike wants to capture some images of his application as it appears on the screen. In order to do this, Mike needs to know how to
Stells [14]
D is the best answer
I hope it’s work
5 0
3 years ago
Other questions:
  • How do computers perform complicated tasks built from simple instructions?
    14·1 answer
  • What do you think about the use the top song on a video you are creating
    8·2 answers
  • Which business filing process puts documents or data in the order by date? a. Linear
    7·1 answer
  • Help me match these answers
    5·1 answer
  • ____ contain instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the sy
    15·1 answer
  • A(n) ______ system is a set of programs that coordinates all the activities among computer or mobile device hardware. a. managem
    10·1 answer
  • man who is colorblind marries a woman who has normal color vision and is not a carrier of color blindness. If this couple has a
    15·1 answer
  • Write a program that takes a point (x,y) from theuser and find where does the point lies. The pointcan
    8·1 answer
  • Give an example where traditional laws and modern media have created "grey areas".
    6·1 answer
  • What does PR stand for ?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!