this in java:
for(int i=0; i<10; i++){ while(i%3!=0) i++; system.out.print(i + " "); }
this output:
0 3 6 9
i trying achieve similar code block in python 3. not able to.
in outer loop, can not use range because causes iteration on whole list read somewhere think. so, trying below, fails dangerously, running infinitely.
i=1 while i<=10: while i%3 not 0: i+=1 print('run')
i have achieved target removing internal while
, changing code i+=3
. program trying make has important conditions has there. there has 2 loops , based on inner loop condition matching, incrementing iteration variable, when break , process program output, parent loop should start iterating left off in inner loop. above example think of share issue. need suggestion on how can replicate changes described in java code in python.
update: here program trying this: https://softwareengineering.stackexchange.com/questions/327908/finding-total-number-of-subarrays-from-given-array-of-numbers-with-equal-max-and
i = 0 while < 10: while % 3 not 0: += 1 print(str(i) + " ") += 1
Comments
Post a Comment