Palindrome Checker Hack
def palindrome_check(input_string):
input_string = input_string.replace(" ", "").lower()
return input_string == input_string[::-1]
user_input = input("Enter a string: ")
if palindrome_check(user_input):
print(f"{user_input} is a palindrome.")
else:
print(f"{user_input} is not a palindrome.")
tacocat is a palindrome.
Real World App:
## Party Invite Tracker Using Lists and if statements
party =["rayyan", "nathan", "aidan", "daniel"]
# def invite_check(input_string):
# input_string = input_string.replace(" ", "").lower()
user_input = input("What is your name?")
if user_input.lower() in party:
print(f"{user_input} is free to enter the party!")
else:
print(f"{user_input} is not on the list you poser")
Natthan is not on the list you poser