That example may not be applicable to this problem. Suggest solve this problem with loops, first, and don’t go into the comprehension solutions until that is covered in the course. Then come back and practice.
In the following example, we have two loops. The outerforloop iterates the first four numbers using therange()function, and the innerforloop also iterates the first four numbers. If theouter number and a current number of the inner loopare the same, then break the inner (nested) loop. ...
The Pythonwhile loopexecutes a block of statements repeatedly as long as the condition is TRUE. We notice that it is a bit similar to theif statement. However, unlike thewhile loop, the if statement executes only once if its condition is TRUE. The while loop has the following syntax: Whil...