Skip to content

Commit e258e5c

Browse files
authored
Add files via upload
1 parent 4115244 commit e258e5c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Palindrome checker Program
2+
3+
def Start(): # A function to start the program
4+
print('----Heyyy, Welcome to the Palindrome Checker----')
5+
print('----------------------------------------------------------------')
6+
7+
while True: # Loop the program until a says no.
8+
choice = input('Do you want to start? (Yes or No): ').lower()
9+
10+
if choice == 'yes':
11+
main()
12+
13+
elif choice == 'no':
14+
print('--------------------------------')
15+
print('Thanks for time...')
16+
break
17+
18+
else:
19+
print('Please enter yes or no')
20+
print()
21+
print('----------------------------------------------------------------')
22+
23+
def accept_word(): # A function to accept user word.
24+
word = input('Enter the word or a number: ')
25+
26+
print('----------------------------------------------------------------')
27+
return word
28+
29+
def Check_Palindrome(word): # A function to check whether a word is a palindrome or not.
30+
31+
if word == word[::-1]: # A condition if the reserved word is same as the actual word.
32+
33+
if word.isdigit():# A condition if the word is a digit for numbers.
34+
print(f'The number "{word}" is a palindrome.')
35+
else:
36+
print(f'The word "{word}" is a palindrome.')
37+
38+
else: # An otherwise condition for word that are not a palindrome.
39+
if word.isdigit():# A condition if the word is a digit for numbers.
40+
print(f'The number "{word}" is not a palindrome.')
41+
else:
42+
print(f'The word "{word}" is not a palindrome.')
43+
44+
print('----------------------------------------------------------------')
45+
46+
def main(): # Main function to take words and check if they are a palindrome or not.
47+
48+
word = accept_word()
49+
print('----------------------------------------------------------------')
50+
Check_Palindrome(word)
51+
52+
53+
if __name__ == '__main__':
54+
Start()

0 commit comments

Comments
 (0)