0

while loop not working as expected:Can you help me?

in my program a task has to be done once while rc==0, then at some point rc+=1,and another task is executed, after which rc=0 and the previous task should start again.This should work in a loop --while index<6:--- every time r gets 0 again index+=1, so after 6 repetitions it should stop. The whole code works if i set ---while index==0:--- ,but it does only one re-iteration,while as soon as i change it in ---while index<6:---,it gives NO OUTPUT. Can someone explain me why it was so perfectly working until i made this tiny change? BELOW THE COMPLETE CODE AND THE CODE W/ JUST THE PART THAT GIVES NO OUTPUT IF CHANGED https://code.sololearn.com/cUHtLN8IOl6H/?ref=app https://code.sololearn.com/ckAsSnoT6Q14/?ref=app

25th Feb 2020, 9:55 PM
Luca
Luca - avatar
1 Resposta
0
This code is very hard to read for me. You should be careful with indentation with so many loops. While at it, it would be better to do at least two spaces, not only one. Try to break the code into functions to make it easier to read and probably you'll find the cause of the problem yourself.
25th Feb 2020, 11:18 PM
Hrvoje
Hrvoje - avatar