Floor 4 - Computer Room
Santa Rosa de Lima English Secondary School
聖羅撒英文中學
Colégio de Santa Rosa de Lima - Secção Inglesa
1.
Review the concept of variable type in Python
2.
Focusing on the syntax of IF Statement
3.
Define IF condition for requirements
1
1
2
1
2
3
1
2
3
4
1
2
3
4
5
6
7
8
if :
1.
2.
Command1
Tab
if Condition :
Command1
False
True
Condition is like a door that controls opening and closing.
else:
Command2
if Condition :
1.
2.
3.
4.
Command1
Tab
Tab
False
If the door is closed
It will execute command2
door = True
if door:
print( 'A' )
else:
print( 'B' )
door = False
if door == False:
print( 'A' )
else:
print( 'B' )
door = 18
if door > 18:
print( 'A' )
else:
print( 'B' )
door = 20
if door > 18 and door < 30:
print( 'A' )
else:
print( 'B' )
door = 20
if door > 18 or door < 30:
print( 'A' )
else:
print( 'B' )
door_A = 20
door_B = door_A != 20
if door_A == 20 and door_B == True:
print( 'A' )
else:
print( 'B' )
value = input( 'Please enter some text here: ' )
1
2
value = input( 'Please enter some text here: ' )
1
2
1
2
3
final_grade = int(input("Enter your final grade (0-100): "))
absence_rate = float(input("Enter your absence rate (0-100%): "))
1
2
3
final_grade = int(input("Enter your final grade (0-100): "))
absence_rate = float(input("Enter your absence rate (0-100%): "))