Download presentation
Presentation is loading. Please wait.
1
Introduction to Computer Science
Programming with Python
2
Loops & Iteration Chapter 5
3
Definite Loops – for loops
For loops are easier to validate They are used to a fixed start and end Example, to go through a list, all the lines in a file, or all the characters in a string
4
Simple for Loop The following loop start from 0 to 10 (it doesn’t execute 10) and print i (counter)
5
A Simple Definite Loop – the Pythonic way
6
A Definite Loop with Strings
7
A Simple Definite Loop – the Pythonic way
9
For Loops in Most Programming Languages
The below example shows a for loop in Java that shows the initialization of the counter that start from 0 to 10, and it increments i (counter) by 1 every iteration. Tip, ++ in most programming languages means +1, but not in Python
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.