- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
# my_first_calculator.py by AceLewis
# TODO: Make it work for all floating point numbers too
if 3/2 == 1: # Because Python 2 does not know maths
input = raw_input # Python 2 compatibility
print('Welcome to this calculator!')
print('It can add, subtract, multiply and divide whole numbers from 0 to 50')
num1 = int(input('Please choose your first number: '))
sign = input('What do you want to do? +, -, /, or *: ')
num2 = int(input('Please choose your second number: '))
if num1 == 0 and sign == '+' and num2 == 0:
print("0+0 = 0")
if num1 == 0 and sign == '+' and num2 == 1:
print("0+1 = 1")
if num1 == 0 and sign == '+' and num2 == 2:
print("0+2 = 2")
if num1 == 0 and sign == '+' and num2 == 3:
print("0+3 = 3")
if num1 == 0 and sign == '+' and num2 == 4:
print("0+4 = 4")
if num1 == 0 and sign == '+' and num2 == 5:
print("0+5 = 5")
if num1 == 0 and sign == '+' and num2 == 6:
print("0+6 = 6")
...
3_14dar 11.09.2016 20:25 # +2
Говно. А так для лабы пойдет.
inkanus-gray 12.09.2016 00:20 # +1
HRWKA 11.09.2016 23:22 # −1
C_T_A_Jl_K_E_P 13.07.2021 23:20 # +1
bagor 12.09.2016 00:58 # +36
Sfabrikan 12.09.2016 07:41 # 0
Segfault 12.09.2016 10:38 # +1
print("Thanks for using this calculator, goodbye :)")
Ne za chto, suka, blyad'!