Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_bugs #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@ def div(a, b):
b = None
op = None

while (True):
while True:
# get input values
a = raw_input("Enter the first argument: ")
op = raw_input("Enter the operation: ")
b = raw_input("Enter the second argument: ")
a = input("Enter the first argument: ")
op = input("Enter the operation: ")
b = input("Enter the second argument: ")
try:
a = int(a)
b = int(b)
except ValueError:
print "Invalid number argument..."
print("Invalid number argument...")
op = None

# decide function
if (op != None):
if (op == "+"):
print "Sum: ", add(a, b)
print("Sum: ", add(a, b))
elif (op == "-"):
print "Difference: ", sub(a, b)
print("Difference: ", sub(a, b))
elif (op == "*"):
print "Product: ", mult(a, b)
print("Product: ", mult(a, b))
elif (op == "/"):
print "Quotient: ", div(a, b)
print("Quotient: ", div(a, b))
else:
print "Invalid operation..."
print("Invalid operation...")

q = raw_input("Quit? [y/n] ")
if (q == "y" or q == "Y"):
q = input("Quit? [y/n] ")
if q == "y" or q == "Y":
break

# -------------------------------------------------------- #