-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.py
54 lines (44 loc) · 2 KB
/
calculator.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
45
46
47
48
49
50
51
52
53
54
print("#####################################################")
print("############ One variable calculator ################")
print("#####################################################\n")
print("*****************************************************")
print("****************** Options **************************")
print("*****************************************************\n")
number = int(input("1: Sum\n2: Substraction\n3: Multiplication\n4: Division\n5: Integer Division\n6: Exponent\n7: Rest\n\nInsert your choice: "))
if number == 1 :
print("You choose Sum\n")
number = float(input("Insert the first number: "))
number += float(input("Insert the second number: "))
print("the result is", number)
elif number == 2 :
print("Elegiste Resta\n")
number = float(input("Insert the first number: "))
number -= float(input("Insert the second number: "))
print("the result is", number)
elif number == 3 :
print("Elegiste Multiplicacion\n")
number = float(input("Insert the first number: "))
number *= float(input("Insert the second number: "))
print("the result is", number)
elif number == 4 :
print("Elegiste Division\n")
number = float(input("Insert the first number: "))
number /= float(input("Insert the second number: "))
print("the result is", number)
elif number == 5 :
print("Elegiste Division Entera\n")
number = float(input("Insert the first number: "))
number //= float(input("Insert the second number: "))
print("the result is", number)
elif number == 6 :
print("Elegiste Exponente\n")
number = float(input("Insert the first number: "))
number **= float(input("Insert the second number: "))
print("the result is", number)
elif number == 7 :
print("Elegiste Modulo o Resto\n")
number = float(input("Insert the first number: "))
number %= float(input("Insert the second number: "))
print("the result is", number)
else:
print("The operation is not valid")