maynul67

Take number input from user and calculate average

Jul 9th, 2021 (edited)
433
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x = int(input("how many numbers?:      "))
  2.  
  3. list = []
  4. for num in range(0,x):
  5.     y = float(input("enter number: "))
  6.     list.append(y)
  7.    
  8.  
  9. sum = 0
  10. a = 0
  11. for num1 in list:
  12.     sum = sum + list[a]
  13.     a = a+1
  14.  
  15. print("sum of the numbers is: ",sum)
  16. avg = sum/x
  17. print("Average is:  ",avg)
RAW Paste Data