Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def total_average():
- total=0
- if command=="total":
- for number_count in range (how_many):
- number = input("Enter number " +str(number_count+1) + " > ")
- total = total + int(number)
- print ("Total =" + str(total))
- elif command == "average":
- for number_count in range (how_many):
- number = input("Enter number " +str(number_count+1) + " > ")
- total = total + int(number)
- result = total / how_many
- print ("the average = " + str(result))
- else:
- print ("Sorry I don't understand")
- finished= False
- while finished == False:
- print("Hi, I am Marvin, your personal bot")
- how_many = input("How many numbers > ")
- how_many = int(how_many)
- command = input ("what do you want to do : total or average > ? ")
- if command =="total":
- total_average()
- elif command=="average":
- total_average()
- elif command =="bye":
- finished = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement