using a break in while loop
hi, so i tried using a break function in a while loop in the code below and that raised a few questions in my mind: def tf_quiz (tf_question, tf_answer): nonsense = "today i tried weed with a "+tf_question + " and a "+ tf_answer return nonsense num_que = 4 counter = 0 while counter <= num_que: shift = tf_quiz (input ("who is the first person i had with today? "),input("who is the second person that shared the weed? ")) print (shift) counter += 1 if tf_quiz("amy","fowler"): break my aim is to stop the loop when it encounters "amy" "fowler" when i run the code without "break" but rather a print statement after the if statement, it works fine. but when the "break" was included if stops after the first loop and doesnt wait to encounter "amy" "fowler". 1. what could be wrong? 2. can one use break directly after "if" (like in the code) or must it come after else