Page 1 of 1

Create a script named "sort.py" that requires exactly one command line argument, which is the name of a file that contai

Posted: Wed Apr 27, 2022 3:33 pm
by answerhappygod
Create a script named "sort.py" that requires exactly one
command line argument, which is the name of a file that contains
numbers (one number per line).
Read the numbers from the file into a list of floats, using a
list comprehension. Sum the list of numbers, sort the list of
numbers, and write the sorted list out to a file named
"sorted.txt".
Display the original list and sum to the console:
Use try/except to print error messages when 1) the input file is
not found or 2) when the data is not in the proper format (one
number per line).
The output file should have all of the same numbers as the input
file, but in sorted order.
{simple code:}