[PDF] Algorithmic Thinking: Loops and Conditionals



Previous PDF Next PDF
















[PDF] jeu de mot comptable

[PDF] image humoristique comptable

[PDF] humour pdf télécharger

[PDF] proverbe comptable

[PDF] bonjour santé montérégie

[PDF] clinique sans rendez vous quebec

[PDF] clinique sans rendez vous montreal

[PDF] clinique medicale sans rendez vous

[PDF] clinique médicale sans rendez-vous

[PDF] clinique sans rendez-vous beloeil

[PDF] clinique sans rendez vous rive sud

[PDF] clinique sans rendez vous laurentides

[PDF] spectre d'émission d'un filament ? 5000°c

[PDF] bac st2s sujet probable 2017

[PDF] sujet bac biologie st2s 2015

Algorithmic Thinking: Loops and Conditionals

Algorithmic Thinking:

Loops and Conditionals

Last Time

†A control flow structure: for loop

†range(n)

range(start, end) range(start, end, step)

†Assignments that modify variables:

x = x + y

Iteration with for loops

def test1(): for i in range(1,6): print("Woof") >>> test1() Woof Woof Woof Woof Woof

What determines how many

times ´Woofµ is printed is the number of elements in the range.

Any expression that gives 5

elements in the range would give the same output.

For example,

range(5 UMQJH0D "

Iteration with for loops

def test2(): for i in range(1,6): print(i, end='-') >>> test2()

1-2-3-4-5-

range(5) AE? range(0, 5) AE? range(1, 6) AE? range(1, 10, 2) AE? range(2, 10, 2) AE? range(10, 1, -1) AE? range(10, 2, -4) AE?

Iteration with for loops

def test3(): for i in range(1,6): print("Woof" * i) >>> test3() Woof

WoofWoof

WoofWoofWoof

WoofWoofWoofWoof

WoofWoofWoofWoofWoof

This expression creates a string

that concatenates i number

RI ´:RRIquotesdbs_dbs2.pdfusesText_2