Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation():
- R1 = input ( "How many numbers?> ")
- numbers = []
- total = 0
- for item_number in range(int(R1)):
- item = input("Enter number >")
- numbers.append(item)
- total = total + int(item)
- if command == "total":
- result = total
- elif command == "average":
- result = total / int(R1)
- print(command + "=" + str(result) )
- finished = False
- while finished == False :
- print("Hi, I am Marvin, your personal bot.")
- command = input("How can I help? ")
- if command == "total":
- do_calculation()
- elif command == "average":
- do_calculation()
- elif command == "bye" :
- finished = True
- else :
- print ("Sorry I do not understand this " )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement