u/k4tsuk1z

help w/ if statement

Making a simple love calculator. When I input Y or N, it automatically skips the if and elif and returns the else statement. What is wrong with my code?

def love_calc ():
    print("Welcome to the Love Calculator! ♡ ")
name1 = str(input("What is your name?: \n"))
name2 = str(input("What is their name?: \n"))
combined_string = name1 + name2
lower_case_string = combined_string.lower()
true_count, love_count = 0, 0
for name in combined_string:
    for letter in ["t","r","u","e"]:
        true_count += name.count(letter)
for name in combined_string:
    for letter in ["l","o", "v", "e",]:
        true_count += name.count(letter)
total_count = int(str(true_count) + str(love_count))
if total_count < 10 or total_count > 90:
    print(f"Your score is {total_count}, you are like peanut butter and jelly!")
elif total_count >= 40 and total_count <= 50:
    print(f"Your score is {total_count}, you go together just fine.")
else:
    print(f"Your score is {total_count}.")
question = input("Would you like to restart? (Y/N): ")
if question == ("Y", "y"):
     love_calc
elif question == ( "N", "n",): 
    print ("Thank you for playing!")
else:
    print("Not a valid response!")
reddit.com
u/k4tsuk1z — 1 day ago