Write a program that asks for a four-digit number from the keyboard and compares the first and last digits

Write a program that asks for a four-digit number from the keyboard and compares the first and last digits, the second and third digits in it. If the first digit is equal to the fourth, and the third to the second, then displays “Palindorm”, otherwise “not Palindorm”.

(Solution provided in Python 3.6.4 programming language)
To begin with, let’s create a variable, the value of which will be entered by the user from the keyboard (a four-digit number).

Next, using the if condition, we compare the first and fourth digit of the number, as well as the second and third. Then we print the corresponding answer. As a result, we get the following program:

a = int (input (‘Enter a four-digit number:’))
if a% 10 == a // 1000 and a% 100 // 10 == a // 100% 10:
print (‘palindorm’)
else:
print (‘not palindrome’)



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.