Advertisement
Lavig

Практика (завдання 10)

May 21st, 2024
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. while True:
  2.     try:
  3.         first_number = (input("\033[1m\033[96mВведіть перше число: \033[0m"))
  4.         second_number = (input("\033[1m\033[33mВведіть друге число: \033[0m"))
  5.         third_number = (input("\033[1m\033[95mВведіть третє число: \033[0m"))
  6.         float(first_number)
  7.         float(second_number)
  8.         float(third_number)
  9.         break
  10.     except:
  11.         print("\033[1m\033[31mВводити можна тільки числа. Спробуйте ще раз!\033[0m")
  12.         continue
  13. first_number = float(first_number)
  14. second_number = float(second_number)
  15. third_number = float(third_number)
  16. if first_number.is_integer() == True:
  17.     first_number = int(first_number)
  18. if second_number.is_integer() == True:
  19.     second_number = int(second_number)
  20. if third_number.is_integer() == True:
  21.     third_number = int(third_number)
  22. m = max(first_number, second_number, third_number)
  23. print("\033[92;1mНайбільше число –\033[97m", m, "\033[0m")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement