Course Content
Python Loops
Python Loops
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.
while condition: inctructions... else: instructions...
Task
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.
Thanks for your feedback!
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.
while condition: inctructions... else: instructions...
Task
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.
Thanks for your feedback!
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.
while condition: inctructions... else: instructions...
Task
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.
Thanks for your feedback!
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.
while condition: inctructions... else: instructions...
Task
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.