-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.py
More file actions
37 lines (32 loc) · 973 Bytes
/
calculator.py
File metadata and controls
37 lines (32 loc) · 973 Bytes
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
print("Select suitable option in next line: ")
print('1: Add')
print('2: Subtract')
print('3: Multiply')
print('4: Divide')
print('5: Remainder')
textinput = int(input('Enter one option: '))
if textinput == 1:
print('For Addition enter two number: ')
a, b = float(input()), float(input())
add = a + b
print('Ans. ', add)
elif textinput == 2:
print('For Subtraction enter two number: ')
a, b = float(input()), float(input())
sub = a - b
print('Ans. ', sub)
elif textinput == 3:
print('For Multiply enter two number: ')
a, b = float(input()), float(input())
mul = a * b
print('Ans. ', mul)
elif textinput == 4:
print('For Divide enter two number: ')
a, b = float(input()), float(input())
div = a / b
print('Ans. ', div)
elif textinput == 5:
print('For Remainder enter two number: ')
a, b = float(input()), float(input())
rem = a % b
print('Ans. ', rem)