Skip to content

MSGanbold/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

an elementary calculator code

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))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages