• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Dec 6th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #This statement introduces the Bot by name
2. print("Hi, I am Marvin, your personal Bot.")
3. #
4. # Seeks input and allocates to variable "command"
5. command=input("Select Function: +, -, *,/  ")
6.
7. #Requests numbers
8. print("enter your numbers")
9. input1 = input("Number 1> ")
10. input2 = input("Number 2> ")
11. #
12. #Tests if Bot is to Add
13. if command=="+":
14.     #converts to integer variables
15.     number1 = int(input1)
16.     number2 = int(input2)
17.     #completes calculation, converts result to string and prints
18.     result = number1 + number2
19.     output=str(result)
20.     print(input1 + " + " + input2 + " = " + output)
21. #
22. #Tests if Bot is to subtract
23. elif command=="-":
24.     #converts to integer variables
25.     number1 = int(input1)
26.     number2 = int(input2)
27.     #completes calculation, converts result to string and prints
28.     result = number1 - number2
29.     output=str(result)
30.     print(input1 + " - " + input2 + " = " + output)
31. #
32. #Tests if Bot is to multiply
33. elif command=="*":
34.     #converts to integer variables
35.     number1 = int(input1)
36.     number2 = int(input2)
37.     #completes calculation, converts result to string and prints
38.     result = number1 * number2
39.     output=str(result)
40.     print(input1 + " x " + input2 + " = " + output)
41. #
42. #Tests if Bot is to divide
43. elif command=="/":
44.     #converts to integer variables
45.     number1 = int(input1)
46.     number2 = int(input2)
47.     #completes calculation, converts result to string and prints
48.     result = number1 / number2
49.     output=str(result)
50.     print(input1 + " / " + input2 + " = " + output)
51. else:
52.     print("Do not understand")
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.

Top