There are a few ways to do this:
- Use a flag variable and just output at the end. (Slightly inefficient if the first response is a
no) - Use a flag variable and a while loop to exit as soon as the user responds with
no. (Can be slightly confusing) - Use the builtin
anymethod. (Can be confusing, not recommended)
flag = Truefor i in range(4): if user[i] != 'y': flag = False # User has answered no to something, set the flag to falseif flag: # User has answered yes to everything # <do your `yes` output>else: # User has answered no to something # <do your `no` output>







