-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator_split().py
More file actions
48 lines (36 loc) · 1.31 KB
/
Copy pathCalculator_split().py
File metadata and controls
48 lines (36 loc) · 1.31 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
39
40
41
42
43
44
45
46
47
48
print()
print(" Mathematics Simple Calculator ")
print("----------------------------------------------------------------------------")
print("This calculator can perform : + , - , * , / , // , % , ** ")
print()
print(" NOTE : Enter with only space after each and every character !!!! ")
print()
text = input("Enter : ")
val=text.split()
# print(val)
if val[1]=='+':
add=int(val[0])+int(val[2])
print("Addition of ",val[0],"and ",val[2],"= ",add)
elif val[1]=='-':
sub=int(val[0])-int(val[2])
print("Subtraction of ",val[0],"and ",val[2],"= ",sub)
elif val[1]=='*':
mul=int(val[0])*int(val[2])
print("Multiplication of ",val[0],"and ",val[2],"= ",mul)
elif val[1]=='/':
div=int(val[0])/int(val[2])
print("division of ",val[0],"and ",val[2],"= ",div)
elif val[1]=='//':
floordiv=int(val[0])//int(val[2])
print("Quotient from floor division of ",val[0],"and ",val[2],"= ",floordiv)
elif val[1]=='%':
rem=int(val[0])%int(val[2])
print("Remainder for division of ",val[0],"and ",val[2],"= ",rem)
elif val[1]=='**':
expo=int(val[0])**int(val[2])
print(val[0],"to the ",val[2],"power = ",expo)
else:
print("Please Enter again !!")
print("Note : Enter with only space after each and every character !!!!")
print()
print("Happy Calculations :) ")