Converting a String to an Integer so that the number can be used in nested if statement

Solution 1:

The reason it is not working is that your first if evaluates everything above 10 as valid.

I included some changes in naming and overall structure to show you how I would have done this script. Those are basic changes just to maybe help you on the way.

print("Welcome to the Love Calculator!")
name_1 = input("What is your name?\n")
name_2 = input("What is their name?\n")
names = name_1+name_2
names = names.lower()

count_1 = 0
for letter in 'true':
    count_1 += names.count(letter)

count_2 = 0
for letter in 'love':
    count_2 += names.count(letter)

temp = f"{count_1}{count_2}"
love_score = int(temp)
if love_score > 90:
    print(f"Your lovescore is {temp}, you go together like coke and mentos")
elif 40 <= love_score <= 50:
    print(f"Your lovescore is {temp}, you are alright together")
else:
    print(f"Your lovescore is {temp}")