Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MSGanbold authored Jul 19, 2019
1 parent 2791100 commit 4406bb1
Showing 1 changed file with 47 additions and 25 deletions.
72 changes: 47 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
#calculator
num_1 = input('Enter the first digit')\n
num_2 = input('Enter the second digit')\n
operator = input('Enter the operation sign')\n

if num_1.isdigit() and num_2.isdigit():\n
num_1 = int(num_1)\n
num_2 = int(num_2)\n

result = None\n
if operator == '+':\n
result = num_1 + num_2\n
elif operator == '-':\n
result = num_1 - num_2\n
elif operator == '/':\n
result = num_1 / num_2\n
elif operator == '*':\n
result = num_1 * num_2\n
else:\n
print('Unknown Operator!')\n
if result!= None:\n
print('{} {} {} = {}'.format(\n
num_1,\n
operator,\n
num_2,\n
result))\n
num_1 = input('Enter the first digit')

num_2 = input('Enter the second digit')

operator = input('Enter the operation sign')

if num_1.isdigit() and num_2.isdigit():

num_1 = int(num_1)

num_2 = int(num_2)


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 4406bb1

Please sign in to comment.