Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I'm Marvin, your personal bot. Let's get started!")
- command = input("How can I help? ")
- if command == "add" or command == "addition" or command =="plus":
- print("Let's do some additions!")
- input1 = input("number one: ")
- input2 = input("number two: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + "+" + input2 + "=" + output)
- elif command == "subtract" or command == "minus":
- print("Let's do some subtractions!")
- input1 = input("number one: ")
- input2 = input("number two: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + "-" + input2 + "=" + output)
- elif command == "multiply":
- print("Let's do some multiplications!")
- input1 = input("number one: ")
- input2 = input("number two: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + "*" + input2 + "=" + output)
- elif command == "divide":
- print("Let's do some division!")
- input1 = input("number one: ")
- input2 = input("number two: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + "/" + input2 + "=" + output)
- elif command =="area":
- print("Let's calculate the area of a rectangle!")
- input1 = input("side a in centimetres: ")
- input2 = input("side b in centimetres: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print("The area of the rectangle is " + output + " centimeters squared.")
- else:
- print("Sorry- I do not understand that command.")
- print("Bye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement