Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON QUESTION 2. Given a file containing test scores, one per line, we want to have a new file that contains the scores in increasing

PYTHON QUESTION

image text in transcribed

2. Given a file containing test scores, one per line, we want to have a new file that contains the scores in increasing order. To do this, write a Python program that asks the user for two file name strings, one for the input scores and the second for the output, sorted scores. The program should open the first file (to read), read the scores, sort them, open the second file (to write), and output to this file the scores in increasing order. There should be one score per line, with the index on each line. As an example, suppose the input file is scores.txt and it contains 75 98 75 100 21 83 15 then running your program should look like (in Wing IDE) Enter the scores file: scores.txt scores.txt Enter the output file: scores_sorted.txt scoressorted.txt When you look at the contents of scores_sorted.txt you should see 0: 15 1: 21 2: 66 3: 75 4: 75 5: 83 6: 98 7: 100 (Output the indices using two integer spaces {:2d] and the scores using three [:3d).) You only need to submit the Python file. We will test with the example above and with a new file you have not seen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

Students also viewed these Databases questions

Question

LO3.3 Describe supply and explain how it can change.

Answered: 1 week ago

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago