Else
else
can be used not only inside if-else statements but after loops. Instructions after else
statement are executing after exiting the loop but not because of break
. If you leave the loop because of break
, else
instructions are skipped.
1234while condition: inctructions... else: instructions...
Swipe to start coding
For the given list list_
, check if all elements in it are positive. Print YES or NO. Use break
to leave the loop if a non-positive number appears.
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Vat dit hoofdstuk samen
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 6.25
Else
Veeg om het menu te tonen
else
can be used not only inside if-else statements but after loops. Instructions after else
statement are executing after exiting the loop but not because of break
. If you leave the loop because of break
, else
instructions are skipped.
1234while condition: inctructions... else: instructions...
Swipe to start coding
For the given list list_
, check if all elements in it are positive. Print YES or NO. Use break
to leave the loop if a non-positive number appears.
Oplossing
Bedankt voor je feedback!
Awesome!
Completion rate improved to 6.25single