daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 74 in 81 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import *
  2.  
  3. def do_calculation():
  4.     print ("Lets calculate the " + command + " of some numbers")
  5.     how_many = int(input("How many numbers do you wish to calculate the " + command + " of? "))
  6.     total = 0
  7.     for number_count in range(how_many):
  8.         number = input("Enter number " + str(number_count + 1) + ": ")
  9.         total = total + int(number)
  10.     if command == "average":
  11.         result = total / how_many
  12.     else:
  13.         result = total
  14.     print("the " + command + " is " + str(result))
  15.  
  16. print("Hi, I'm Marvin, your personal bot.")
  17. command = input("How can I help? ")
  18. if command == "average" or command == "total":
  19.     do_calculation()
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. OK, I Understand
 
Top