Answer to Question #114569 in Python for Mohammed

Question #114569
Write a Python program that reads lines from an input file called data.txt. Each line consists of a keyword, followed by a sequence of numbers separated by commas. The keyword UP indicates that the number should be sorted in ascending order, while the keyword DOWN indicates that the number should be sorted in descending order. The program sorts the numbers and saves them in the file called sorted.txt. For example, if the data.txt file contains
UP 25 35, 30, 40, 30
DOWN 20, 30, 25, 25 DOWN 35, 45, 40, 15, 16, 18
The file sorted.txt will contain
25 30 30 35 40
30 25 25 20
45 40 35 18 16 15
1
Expert's answer
2020-05-06T20:16:03-0400
Dear Mohammed, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS