Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Science

Similar presentations


Presentation on theme: "Introduction to Computer Science"— Presentation transcript:

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

8

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


Download ppt "Introduction to Computer Science"

Similar presentations


Ads by Google