• API
• FAQ
• Tools
• Archive
SHARE
TWEET # average or total wendyk  Aug 25th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top