Skip to content

Commit

Permalink
calculator_code
Browse files Browse the repository at this point in the history
Note: if num_1.isdigit() instead of num_1.is_digit()
  • Loading branch information
MSGanbold authored Jul 19, 2019
1 parent 47feed2 commit a178823
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#calculator
new text
num_1 = input('Enter the first digit')
num_2 = input('Enter the second digit')
operator = input('Enter the operation sign')

some local text
if num_1.isdigit() and num_2.isdigit():
num_1 = int(num_1)
num_2 = int(num_2)

here is a pulled change
result = None
if operator == '+':
result = num_1 + num_2
elif operator == '-':
result = num_1 - num_2
elif operator == '/':
result = num_1 / num_2
elif operator == '*':
result = num_1 * num_2
else:
print('Unknown Operator!')
if result!= None:
print('{} {} {} = {}'.format(
num_1,
operator,
num_2,
result))

0 comments on commit a178823

Please sign in to comment.