mirror of
https://github.com/yawaflua/Calculator-in-cmd.git
synced 2025-12-08 19:39:29 +02:00
1.0.0
This commit is contained in:
39
calculator.py
Normal file
39
calculator.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# https://github.com/yaflay
|
||||
import time
|
||||
# take modules
|
||||
|
||||
number_1 = int(input('First number = ') )
|
||||
time.sleep(0.3)
|
||||
# take first number
|
||||
|
||||
number_2 = int(input('Second number = ') )
|
||||
time.sleep(0.3)
|
||||
# take second number
|
||||
|
||||
operator = input('Operator = ')
|
||||
time.sleep(0.3)
|
||||
# take operator
|
||||
|
||||
a = str(number_1) + str(operator) + str(number_2)+ '='
|
||||
print(a)
|
||||
|
||||
if operator == '/':
|
||||
print(number_1 / number_2)
|
||||
# calculation
|
||||
else:
|
||||
if operator == '-':
|
||||
print(number_1 - number_2)
|
||||
else:
|
||||
if operator == '*':
|
||||
print(number_1 * number_2)
|
||||
else:
|
||||
if operator == '+':
|
||||
print(number_1 + number_2)
|
||||
else:
|
||||
if operator == '%':
|
||||
print(number_1 % number_2)
|
||||
else:
|
||||
if operator == '**':
|
||||
print(number_1 ** number_2)
|
||||
|
||||
# Hello, this is my first work on GitHub. Thanks for some attention
|
||||
Reference in New Issue
Block a user