Змея / Говнокод #21168 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 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")
...

https://github.com/AceLewis/my_first_calculator.py/blob/master/my_first_calculator.py оптимизация!

Запостил: j123123 j123123, (Updated )

Комментарии (7) RSS

Добавить комментарий

Я, guest, находясь в здравом уме и твердой памяти, торжественно заявляю:

    А не использовать ли нам bbcode?


    8