Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am Scott, your personal bot and I love Maths.Hope you do too.")
- # ask the user to input a command
- command = input ("How can I help amigo?")
- if command == "add":
- print("lets add some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + " + " + input2 + " = " + output)
- elif command == "subtract":
- print("lets subtract some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " - " + input2 + " = " + output)
- elif command == "multiply":
- print("lets multiply some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + " x " + input2 + " = " + output)
- elif command == "divide":
- print("lets divide some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + " / " + input2 + " = " + output)
- elif command == "average":
- how_many = input("how many numbers> ")
- how_many = int(how_many)
- total = 0
- for number_count in range (how_many):
- number = input("Enter number " + str(number_count) + "> ")
- total = total + int(number)
- result = total / how_many
- print("the average = " + str(result))
- elif command == "create a shopping list":
- shopping = []
- how_many = input("how many items of shopping do you have?")
- how_many = int(how_many)
- for item_number in range(how_many):
- item = input("what is the item number " + str(item_number) + "? ")
- shopping.append(item)
- print(shopping)
- print("you have got " + str(how_many) + " items in your shopping list")
- else:
- print("sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement