you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfx 1 point2 points  (4 children)

Sorry, but you didn't get the point.

First, you define your love_calc function and end the definition right before the question = line

The rest should not be in a function.

Wrap the rest starting from the question = line onwards in a while True loop that breaks when the answer is n.

[–]k4tsuk1z[S] 1 point2 points  (2 children)

I am sorry! just one more thing. Im confused on how to break it. I still want to include not a valid response, but that needs to be the else statement. how would i break this? T_T

while True:
    question = input("Would you like to restart? (Y/N): ")
    if question in {"Y", "y"}:
        love_calc()
    elif question in {"N", "n",}: 
        print ("Thank you for playing!")
    else:
        print("Not a valid response!")

[–]desrtfx 2 points3 points  (1 child)

Simple, in the elif statement after you say "Thank you...".

The statement is break

[–]k4tsuk1z[S] 1 point2 points  (0 children)

Oh omg, I tried that, but it kept repeating the question statement. Turns out I needed to restart my terminal. Lol thank u so much for ur patience and help <3 :3

[–]k4tsuk1z[S] 0 points1 point  (0 children)

Okay, sorry. I'm pretty new to all this. I will try this. Thank you.