We continue to learn the programming language. Let’s move on to chapter 4 of the book: Michael Dawson “Python Programming”, 2014 (Michael Dawson “Python Programming for the Absolute Beginner”, 3rd Edition), where we will study loops with the for () operator, introducing constants into code, slices and tuples, working with sequences on the example of strings with the operators len()
, range()
, in
, jumble()
, etc.
Summary of chapter 4 with examples of programs I wrote:
Содержание:
Cycles (loops) for
We already know loops with the while
statement, and have even done a lot of tasks. Remember, there is a control variable introduced before the loop, which is then used in the condition, which in turn is tested for truth every round of the loop. So with the for
loop, things are a little different. Читать