• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Dec 17th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import math
2. print("Hi, I am Marvilla, your personal bot.")
3. command = input("How can I help? ")
4. if command == "add" or command == "plus":
6.     input1 = input("Number 1> ")
7.     input2 = input("Number 2> ")
8.     number1 = int(input1)
9.     number2 = int(input2)
10.     result = number1 + number2
11.     output = str(result)
12.     print(input1 + " + " + input2 + " = " + output)
13.
14. elif command == "subtract":
15.     print("lets subtract some numbers")
16.     input1 = input("Number 1> ")
17.     input2 = input("Number 2> ")
18.     number1 = int(input1)
19.     number2 = int(input2)
20.     result = number1 - number2
21.     output = str(result)
22.     print(input1 + " - " + input2 + " = " + output)
23.
24. elif command == "divide":
25.     print("lets divide some numbers")
26.     input1 = input("Number 1> ")
27.     input2 = input("Number 2> ")
28.     number1 = int(input1)
29.     number2 = int(input2)
30.     result = number1 / number2
31.     output = str(result)
32.     print(input1 + " / " + input2 + " = " + output)
33.
34. elif command == "multiply":
35.     print("lets multiply some numbers")
36.     input1 = input("Number 1> ")
37.     input2 = input("Number 2> ")
38.     number1 = int(input1)
39.     number2 = int(input2)
40.     result = number1 * number2
41.     output = str(result)
42.     print(input1 + " * " + input2 + " = " + output)
43.
44. elif command == "squareroot":
45.     print("Lets found out the squareroot of number: ")
46.     square = input("Number:")
47.     squarenumber = int(square)
48.     squareroot = math.sqrt(squarenumber)
49.     output = str(squareroot)
50.     print("The square root of " + square + " = " + output)
51.
52. elif command == "power":
53.     print("Lets calculate with power! Fill a base number: ")
54.     number = input("Number:")
55.     topower = input("to the power:")
56.     raisednumber = int(number)
57.     raisedpower = int(topower)
58.     power = math.pow(raisednumber, raisedpower)
59.     strnumber = str(number)
60.     strpower = str(topower)
61.     output = str(power)
62.     print(strnumber + " to the power " + strpower + " = " + output)
63.
64. else:
65.     print("Sorry i dont 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