l1.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import sys
  2. pol = input('Начнем(да/нет) ')
  3. sp = []
  4. def poll():
  5. pol1 = float(input('Температура: '))
  6. pol2 = input('Единица (C/F): ')
  7. if pol2=='C':
  8. x = pol1*1.8+32
  9. xx = f'{pol1}C = {x}'
  10. sp.append(xx)
  11. print(f'{pol1}C = {x}')
  12. elif pol2=='F':
  13. f = (pol1 - 32)/1.8
  14. ff = f'{pol1}F = {f}'
  15. sp.append(ff)
  16. print(ff)
  17. else:
  18. print('Введите верную букву')
  19. def his():
  20. print(sp)
  21. def circle():
  22. while True:
  23. if pol=='да':
  24. poll()
  25. print('1. Продолжить\n2. Закончить\n3. История')
  26. po = input('Число ')
  27. if po=='1':
  28. continue
  29. elif po=='2':
  30. sys.exit(1)
  31. elif po=='3':
  32. his() # Костыль
  33. else:
  34. print('Не то число')
  35. elif pol=='нет':
  36. sys.exit(1)
  37. else:
  38. print('нет')
  39. circle()