-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc.py
44 lines (36 loc) · 974 Bytes
/
calc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Calculator #
import math
print('''
_________________________
/ _____________________ \\
| | _________________ | |
| | | CALC | | |
| | | | | |
| | | 7 8 9 + | | |
| | | 4 5 6 - | | |
| | | 1 2 3 * | | |
| | | 0 . = / | | |
| | |_________________| | |
| |_____________________| |
|_________________________/
''')
print("Welcome to the Cool Calculator!")
print("To use this calculator, please enter the following:")
print("- The first number:")
print("- An operator (+, -, *, /):")
print("- The second number:")
print("")
num1 = float(input("Enter first number:"))
operator = (input("Add the operator:"))
num2 = float(input("Enter second number:"))
if operator == "+":
result = num1 + num2
elif operator == "-":
result = num1 - num2
elif operator == "*":
result = num1 * num2
elif operator == "/":
result = num1 / num2
else:
print("Invalid operator")
print("Result: ", result)