Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #from origina bot
- print("Hi I am John's bot")
- #two new lines
- command = input("How can I help? ")
- if command == "add" or command == "Add" or command == "plus":
- print("lets add some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- print (result)
- output = str(result)
- print("or in full....")
- print(input1 + " + " + input2 + " = " + output)
- elif command == "subtract" or command == "Minus" or command == "minus":
- print("lets subtract some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- print (result)
- output = str(result)
- print("or in full....")
- print(input1 + " - " + input2 + " = " + output)
- #Your challenge is to update your program so it can:
- # • solve division or multiplication problems when given the commands “divide” or “multiply”.
- # • work out another problem you have chosen. This could be calculating an area, how much your weekly shopping costs, or anything else you like.
- elif command == "divide" or command == "div" or command == "div by":
- print("lets divide some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- print (result)
- output = str(result)
- print("or in full....")
- print(input1 + " / " + input2 + " = " + output)
- elif command == "multiply" or command == "times" or command == "times by":
- print("lets multiply some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- print (result)
- output = str(result)
- print("or in full....")
- print(input1 + " x " + input2 + " = " + output)
- #motivated by previous work on https://scratch.mit.edu/projects/306896953/
- elif command == "shape angles" or command == "polygon angles":
- print("Let's work out the internal angles of your polygon")
- input1 = input("How many sides does your polygon have?")
- #input2 = input("Number 2> ")
- number1 = int(input1)
- #number2 = int(input2)
- result = 180 - 360/number1
- print (result)
- output = str(result)
- print("or in full....")
- print(" Your " + input1 + " sided shape has internal angles of " + output + " degrees")
- else:
- print("Computer bot does not understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement