From 0a25a371203c916ce385324813889798a0aec068 Mon Sep 17 00:00:00 2001 From: SharmilaSrinivasa <40612676+SharmilaSrinivasa@users.noreply.github.com> Date: Tue, 26 Jun 2018 15:43:03 -0500 Subject: [PATCH] Rewrite the program that prompts the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters "done". Write the program to store the numbers the user enters in a list and use the max() and min() functions to compute the maximum and minimum numbers after the loop completes. Enter a number: 6 Enter a number: 2 Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: done Maximum: 9.0 Minimum: 2.0 --- ...m and minimum numbers after the loop completes." | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "Rewrite the program that prompts the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters \"done\". Write the program to store the numbers the user enters in a list and use the max() and min() functions to compute the maximum and minimum numbers after the loop completes." diff --git "a/Rewrite the program that prompts the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters \"done\". Write the program to store the numbers the user enters in a list and use the max() and min() functions to compute the maximum and minimum numbers after the loop completes." "b/Rewrite the program that prompts the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters \"done\". Write the program to store the numbers the user enters in a list and use the max() and min() functions to compute the maximum and minimum numbers after the loop completes." new file mode 100644 index 0000000..9d8738d --- /dev/null +++ "b/Rewrite the program that prompts the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters \"done\". Write the program to store the numbers the user enters in a list and use the max() and min() functions to compute the maximum and minimum numbers after the loop completes." @@ -0,0 +1,13 @@ +lst= list() +while True: + num = input('Enter a number:') + if num == 'done': + break + try: + num = float(num) + except: + print('enter numeric data') + continue + lst.append(num) +print('Maximum:',max(lst)) +print('Minimum:',min(lst))