+ 1
For loops and Continue
Can anyone give me tips on why this doesn't have any output. This is in Python. Am I missing something? letter = 1 for w in 'Akeno Himejima': if w == 'H': continue print('A is not to be processed ') print('Letter ', letter, 'is ', w) w+=1
5 Antworten
+ 5
Yes you are. :) Code after continue won't execute. Either indent it differently or change the logic of your code.
Of course, notice that you are adding 1 to the variable that is not a counter...
num = 1
for w in 'Akeno Himejima':
if w == 'H':
continue
print('A is not to be processed ')
print('Letter', num, 'is', w)
num += 1
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/break-continue
+ 5
What are you trying to achieve with your code? I'm having problems understanding what you are trying to do here.
Everything after the continue will not be processed because it iterates the loop immediately. So everything below it will be skipped.
+ 5
Hope this helps
https://code.sololearn.com/cWchq44ygtdQ/?ref=app
+ 4
dρlυѕρlυѕ and the first print put before continue, and change A to H
+ 1
thanks so much