Sample Paper 1 by Teachoo

Computer Science - Class 11
Teachoo Sample Paper

## Write a Python program that takes a list of numbers as input from the user and prints the sum, average, minimum, and maximum of the numbers in the list.

 def my_sum (numbers):   total = 0   for num in numbers:     total += num   return total   def my_min (numbers):   minimum = numbers[ 0 ]   for num in numbers:     if num < minimum:       minimum = num   return minimum   def my_max (numbers):   maximum = numbers[ 0 ]   for num in numbers:     if num > maximum:       maximum = num   return maximum   user_input = input( "Enter the numbers separated by commas: " ) numbers = [float(num) for num in user_input.split( "," )] total = my_sum(numbers) average = total / len(numbers) minimum = my_min(numbers) maximum = my_max(numbers) print( "The sum of the numbers is" , total) print( "The average of the numbers is" , average) print( "The minimum of the numbers is" , minimum) print( "The maximum of the numbers is" , maximum) 