Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Ask the user for a string and print out whether this string is a palindrome or not.
- #(A palindrome is a string that reads the same forwards and backwards.)
- prompt1 = input("Pls enter a string \n")
- if prompt1.isalpha():
- if prompt1 == prompt1[::-1]:
- print(f"{prompt1} is a palindrome \n ")
- else:
- print(f"{prompt1} is not a palindrome \n ")
- else:
- print("Invalid entry \n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement