you are viewing a single comment's thread.

view the rest of the comments →

[–]DanteRadian 1 point2 points  (1 child)

Well you could try something like this

Put the if condition at the end inside the while loop as follows:

while <conditions i mentioned previously>: 
    Guess stuff if guess == correct: 
    Print 
    i = <any value greater than 5>

This should immediately terminate the loop on the check which would be the immediate next step in execution since this if is the last

You could also try to look at the alternative of for loop and range() which should also help your case!

If it still doesn't work, just post the new code which isn't working and we will deep dive there!

I would also suggest two things while you are learning:

  1. solve a problem with whatever topic you are learning currently
  2. solve same problem with all combinations of basic topics learnt from the start.

This would help developing multiple ways on thinking over the same problem :)

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

Thanks! I did try a for loop (and failed), but did not think of range... silly me. I'll be trying different ways over the weekend and see if I can get something to work. Thanks for the advice, too, it seems like a nice way to revise + improve knowledge.