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
Complete the following tasks. When you are finished, click Done to close the lab and move to the next question. After you click
DiKsa [7]

What would be the correct cable would be an DSL cord for the phonelines.

8 0
3 years ago
Which you could use an Excel chart to present your data?
Svetach [21]
Determining what percentage of customer 101 buys product A, and what percentage of the customer buys product B
6 0
3 years ago
The java compiler is able to find all programmer errors.
Troyanec [42]
No compiler can do that. Maybe with AI, but that's beyond the scope of a compiler.
5 0
4 years ago
Case 9-2 Gracie is trying to decide between Windows or macOS for her new desktop computer. Since you have desktops that run both
MrMuchimi

Answer:

Finder

Explanation:

The Finder is the default file manager and graphical user interface shell used on all Macintosh operating systems. Described in its "About" window as "The Macintosh Desktop Experience", it is responsible for the launching of other applications, and for the overall user management of files, disks, and network volumes.

- this seems very course reliant, refer to your course if this is not the answer you were looking for.

3 0
3 years ago
You have repaired a broken LCD panel in a laptop computer. However, when you disassembled the laptop, you bent the hinge on the
Romashka-Z-Leto [24]

Answer:

Listen carefully to the customer and avoid getting defensive or even offensive.

Explanation:

The customer have every right to be angry since he might be ignorant of the work done and only act base on what he sees. In this scenario you need to listen carefully to his complain avoid been defensive and also avoid getting him/her more angry by been offensive. after he has laid out his complain you can then go ahead to explain why it is necessary to bend the hinge on the lid.

5 0
3 years ago
Other questions:
  • On the Internet, you can use a(n)______to look for information on any topic, such as books, movies, scholarly articles, news, an
    6·2 answers
  • Which is a good plan for backing up data?
    6·1 answer
  • The software program you need to have to read PDF file, such as the PDF files you download from your My Courses page, is
    9·2 answers
  • public class Test { public static void main(String[] args) { try { method(); System.out.println("After the method call"); } catc
    12·1 answer
  • Which of the following letters do the most reliable websites end in?
    12·2 answers
  • Write a code that calculates the Greatest Common Divisor (GCD) of two positive integers (user-defined inputs). Include an except
    10·1 answer
  • A large electronic game manufacturer decides to establish a customer service center in Lahore, Pakistan. This is an example of _
    10·1 answer
  • List three types of Software:
    15·1 answer
  • MR. Tom asked her students could they plant a flower and bring it to class. Sarah brought his flower and said it was a rose. Jam
    6·1 answer
  • PLEASE HELP
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!