Advertisement
wendyk

average or total

Aug 25th, 2019
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. command = input ("Choose total or average ")
  2. if command != "average" and command != "total":
  3. print ("sorry I don't understand")
  4. else:
  5. NoN = input("How many numbers will we use? ")
  6. NoN = int(NoN)
  7. total = 0
  8. for number_count in range(NoN):
  9. no1 = input("Give me a number?")
  10. num1 = int(no1)
  11. total = total + num1
  12. if command == "total":
  13. total = total + num1
  14. tot = str(total)
  15. print ("The total is " + tot)
  16. elif command == "average":
  17. total = total + num1
  18. resultA = total / NoN
  19. print ( "The average is " + str(resultA))
  20. print ("ByeBye")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement