Replacing For With While

When introducing for loops, we mentioned that you can always use a while loop instead of a for loop. That’s pretty tricky to do without break. However, with break, it’s much easier. The basic idea is that we want to break as soon as we encounter a None.

Get hands-on with 1000+ tech skills courses.