project_python/2.2_lesson.7.20.py

24 lines
838 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

''' ****** Задание 7(G) из 20 Параграф 2.2 *********
* А как быстро понять, является ли слово палиндромом? Написать программу для проверки этого! В этом нам снова поможет условный оператор.
'''
if __name__ == "__main__"
try:
number = int(input())
if 1000 <= number <= 9999:
a = number // 1000
b = (number // 100) % 10
c = (number // 10) % 10
d = number % 10
if a == d and b == c:
print("YES")
else:
print("NO")
else:
print("NO")
except ValueError:
print("Ошибка: введите корректное четырехзначное число.")