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
Which category does this fall in identity theft​
g100num [7]

Answer:

A crime.

Explanation:

It's illegal.

8 0
3 years ago
What is the name of the file manager in Microsoft Windows? The file manager used in Microsoft Windows is
miss Akunina [59]

It is called File Explorer

5 0
4 years ago
Read 2 more answers
Which is NOT a reason to study science?
VMariaS [17]
Hi!

Science is a way of thinking about the natural world. It asks thought provoking questions and investigates deep into the human mind, our Earth, our periodic table, or our cosmos.

It's a vast field, with a myriad of career options. Scientists want to learn more about how our natural world works, and experiment to discover newfound facts about life as we know it.

Not to <em>blow... </em>away... your... expectations... but, in science, we rarely blow up things. If you're interested in seeing explosions, go apply to be a myth buster.

Hopefully, this helps! =)
8 0
4 years ago
6. According to camp policy, staff members need to be at least 23 years old to transport students. Dean now wants to determine h
Kamila [148]

Answer:

This seems to be related to MS Excel, here we will discuss the related formula:

<u>=IF(VLOOKUP("Adam Moriarty",$B$3:$C$5,2)>23,"Yes","No")</u>

the name can also be written in adjacent to J2 cell i.e. I2 and its reference to be used in vlookup primary key as follows:

<u>=IF(VLOOKUP(I2,$B$3:$C$5,2)>23,"Yes","No")</u>

Explanation:

We have used simple IF function combined with VLOOKUP function to reference this formula to the table of names and ages of the members (here the table is $B$3:$C$5 and ages are mentioned in 2nd column of the table)

please find attached screenshot for clarification

6 0
3 years ago
Hawaii and japan are examples of islands made by? You have to write it.
Brums [2.3K]

Answer:

Volcanic activity

5 0
3 years ago
Other questions:
  • Suppose you are the security manager of a company and one of your goals is to design security mechanisms based on three security
    10·1 answer
  • With the help of what memory a computer can read as well as write or modify data
    14·2 answers
  • Can someone explain a cylinder
    7·1 answer
  • Playstation network live updates pes 2018 does it cost extra
    13·1 answer
  • Complete the GiftCard class shown below. A GiftCard keeps track of the current balance on the card. A gift card starts with a be
    11·1 answer
  • What is a software? 2 sentences please, I'll mark u as brailiest
    12·1 answer
  • How do you make someone the Brainliest?
    13·1 answer
  • Q9. Complete the table with the name of the functions
    12·1 answer
  • A _ is the acknowledgment of a potential noncomformity, or an opinion regarding an issue that is not covered by a standard
    6·1 answer
  • Combining data and code in a single object is known as
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!