Skip to content

Commit

Permalink
Merge pull request pclubuiet#15 from WebClub-NITK/anusolve
Browse files Browse the repository at this point in the history
Simple Calculator in python using if elif
  • Loading branch information
sbshah97 authored Oct 4, 2017
2 parents 8752ae2 + 1e78731 commit 25bfeb7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
operators=['+','-','*','/','**','%']
a=input("Enter operand")
b=float(input("Enter number1"))
c=float(input("Enter number2"))
if a=='+':
print(b+c)
elif a=='-':
print(b-c)
elif a=='*':
print(b*c)
elif a=='/':
if c == 0:
print("Division by zero not allowed")
else:
print(b/c)

elif a=='%':
if c == 0:
print("Modulo by zero not allowed")
else:
print(b%c)

elif a=='**':
print(b**c)
else:
print("Invalid operation")

0 comments on commit 25bfeb7

Please sign in to comment.