Search Header Logo
Python教學(2) if for while

Python教學(2) if for while

Assessment

Presentation

Computers

11th Grade

Hard

Created by

桂初 鄭

Used 3+ times

FREE Resource

18 Slides • 8 Questions

1

Python教學(2)

2

IF Statement

3

IF Statement

Python supports the usual logical conditions from mathematics:

  • Equals: a == b

  • Not Equals: a != b

  • Less than: a < b

  • Less than or equal to: a <= b

  • Greater than: a > b

  • Greater than or equal to: a >= b

4

IF Statement

  • if

  • if...else

  • if...elif...else

5

IF (單向)

media

6

IF...ELSE...(雙向)

media

7

IF...ELIF...(多重條件)

media

8

IF...ELIF...ELSE(多重條件)

media

9

Multiple Choice

Question image

圖中的程式能否正確執行?

1

可正常執行

2

無法執行

10

Multiple Choice

Question image

圖中的程式能否正確執行?

1

可正常執行

2

無法執行,

因缺少了標點符號

3

無法執行,

因if 條件句缺少了縮排

11

Multiple Choice

Question image

執行圖中的程式結果為何?

1

印出A

2

印出B

3

沒有印出任何結果

12

While Loops

​while 條件
執行程式

13

While Loops

media

14

While Loops---break

​結果:
1
2
3

media

15

While Loops---break

​結果:
1
2
4
5
6

media

16

Fill in the Blanks

media image

Type answer...

17

Fill in the Blanks

media image

18

For Loops(列印lists中的元素)

media

19

For Loops(列印字串中的字母)

media

20

For Loops(列印字串中的字母)

media

21

For Loops(列印數字範圍)

Note that range(6) is not the values of 0 to 6, but the values 0 to 5.

media
media

22

For Loops(列印數字範圍)

media

range(2, 6), which means values from 2 to 6 (but not including 6):

23

Multiple Choice

Question image

執行圖中的程式結果為何?

1

Exit the loop when x is "cherry"

2

Only print "apple"

3

Print "apple" and "banana"

4

Print all elements

24

Multiple Choice

Question image

執行圖中的程式結果為何?

1

Exit the loop when x is "cherry"

2

Only print "apple"

3

Print "apple" and "banana"

4

Print all elements

25

Multiple Choice

Question image

執行圖中的程式結果為何?

1

0

1

2

3

2

1

2

3

4

3

2

3

4

5

4

3

4

5

6

26

For inner Loops(巢狀回圈)

media
media

Python教學(2)

Show answer

Auto Play

Slide 1 / 26

SLIDE