5 Iteration and Randomness

In Chapter 4, you learned how to program divergent paths for Python to follow. In this chapter, you’ll create looped paths with while and for loop statements. Loop statements repeat actions, so you don’t need to rewrite the same or similar code multiple times, resulting in fewer lines of code. In other words, you can solve problems more efficiently with code that’s easier to adapt. You’ll use these loop statements to generate visual patterns in Processing.

You’ll also learn to apply randomness to your patterns to make them more compelling and unpredictable. Processing’s random() function is useful for generating ...

Get Learn Python Visually now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.