Can someone help me figure out why this loop is infinite? The class I am in automatically inputs the variables for me per those last 2 lines. It passes the test with numbers 2 and 4. However there is another input, that I am unable to see, that keeps this running as an infinite loop. I can not figure out where there is a gap in this code that would allow an infinite loop. Any suggestions?
def shampoo_instructions(user_cycles):
N = 1
while N <= user_cycles:
if N < 1:
print('Too few')
elif N > 4:
print('Too many')
else:
print(N,': Lather and rinse.')
N = N + 1
print('Done.')
user_cycles = int(input())
shampoo_instructions(user_cycles)
N = N + 1to happen? In your own words, if that doesn't happen, then why should the result ofN <= user_cycleschange? If that doesn't happen, why would the loop end?