Ex3 AI and Python
Ex3 AI and Python
Lesson 3
除錯 (Debug)
• 試指出導致以下程式無法運行的原因。 Page22
沒有匯入函數庫 (Library)。
2
Debug
• 試指出導致以下程式無法運行的原因。 Page22
使用了相關函數後
才匯入函數庫。
3
測試站 1.1 Page 26
2. C
1. A
3. D
4
Conditional Statements
5
“If” Conditional Statements
1
●Write your program according to the figure below.
[Link]
[Link]
[Link]
6
“If” Conditional Statements
• The code in the “if” body will only be executed when the condition is satisfied
otherwise, the code will be ignored and this conditional statement ends.
7
Comparison Operators
● compare the values on
both sides
● ✅values, variables and
mathematical operators
on both sides.
Which string is shown in the
Conditional Statement shell? Hello World! or
Goodbye World! , why ?
1. Write the program.
[Link] 2
use == instead of = to
compare if two values are equal.
Conditional Statement
[Link]
Change your program
Only four characters are printed.
What are they? 2
[Link]
11
Relational Operators
• When we use conditional statements, we can pair them with relational operators to
compare the values on both sides and evaluate the condition
12
Indentation
13
Conditional Statement 4
[Link]
Create a new program
according to the
right figure.
16
Mission Time
● Task1: Currency_Converter
17
Mission Time
18