-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.py
More file actions
38 lines (28 loc) · 1.1 KB
/
Calculator.py
File metadata and controls
38 lines (28 loc) · 1.1 KB
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
i = "y"
print("")
print("Welcome, I will help you with calculations.\n")
while i == "yes" or i == "y" or i == "":
num1 = float(input("Enter First Number : "))
op = input("Enter Operator (+ - * / ^) : ")
num2 = float(input("Enter Second Number : "))
print("")
if op == "+":
print("Result : " + str(num1 + num2))
elif op == "*":
print("Result : " + str(num1 * num2))
elif op == "-":
print("Result : " + str(num1 - num2))
elif op == "/":
print("Result : " + str(num1 / num2))
elif op == "^":
print("Result : " + str(pow(num1,num2)))
elif op != "+" or op != "-" or op != "*" or op != "/" or op != "^":
print("ERROR : Invalid Operator")
print("\nUse amongst one of these:\nAddition : + \nSubstraction : - \nMultiplication : * \nDivision : /\nSquare : ^")
else:
print("ERROR : Unknown Error Occurred.")
print("")
i = input("Wanna Try That Again (Yes/No) : ").casefold()
print("")
print("Thank for using our application.")
print("You are a no lyfer, you should die.")