Conditional statements (IF/ELSE)
Дипломдар мен сертификаттарды алып үлгеріңіз!
1 слайд
Conditional statements (IF/ELSE) Theme of today's lesson :
Learning objectives:
apply if statement, identify comparison
operators, apply if/else statement
1 слайд
Conditional statements (IF/ELSE) Theme of today's lesson : Learning objectives: apply if statement, identify comparison operators, apply if/else statement
2 слайд
Key words and phrases:
software , input, output,
process, syntax , phrase, source,
variable ,value, conditional,
indentation , select
2 слайд
Key words and phrases: software , input, output, process, syntax , phrase, source, variable ,value, conditional, indentation , select
3 слайд
We begin the lesson with game
“If…….then…….else’
Example:
First group: If you don’t dress warmly in
winter…….
Second group: you'll get sick/
Second group : In winter you need to dress
warmly.
First group: you'll get sick
3 слайд
We begin the lesson with game “If…….then…….else’ Example: First group: If you don’t dress warmly in winter……. Second group: you'll get sick/ Second group : In winter you need to dress warmly. First group: you'll get sick
4 слайд
Let’s do the task
“WordSearch”.
4 слайд
Let’s do the task “WordSearch”.
5 слайд
software
input
output
process
Syntax
phrase
source
variable
value
conditional
indentation
select
5 слайд
software input output process Syntax phrase source variable value conditional indentation select
6 слайд
Ask the questions:
What does the input mean?
What does the output mean?
What is variable?
Write operators for input?
Write operators for output?
6 слайд
Ask the questions: What does the input mean? What does the output mean? What is variable? Write operators for input? Write operators for output?
7 слайд
Input is a data to solve a problem
Process is aktivites to get a resuit
Output is a result of a problem
Variable is a memory area for storing data and having its own name.
i. x=input(“Enter the data”) – gets data as string
ii. a= int(input(“Enter the data”)) – gets the data as int
(number)
iii. a,b,c= map(int,input(“Enter 2 variabels:”).split()) -
gets three data as int
print(“Hello world”)
print(“I am happy to study Pyton”)
print(a)
7 слайд
Input is a data to solve a problem Process is aktivites to get a resuit Output is a result of a problem Variable is a memory area for storing data and having its own name. i. x=input(“Enter the data”) – gets data as string ii. a= int(input(“Enter the data”)) – gets the data as int (number) iii. a,b,c= map(int,input(“Enter 2 variabels:”).split()) - gets three data as int print(“Hello world”) print(“I am happy to study Pyton”) print(a)
8 слайд
Playing a game “Kahoot”
8 слайд
Playing a game “Kahoot”
9 слайд
Activity: “Fill in the table of operators”
9 слайд
Activity: “Fill in the table of operators”
10 слайд
operator operation Example
eguation Example code result
+ addition 3+2 a=3+2 a=5
- substraction 3-2 a=3-2 a=1
* multiplication 3∙2 a=3*2 a=6
/ dinision a=10/2 a=5
// floordivision N/A a=10//3 a=3
** power a=2**3 a=8
% modulus N/A a=8%3 a=2
> greater 5>3 5>3
if 5 is greater than 3 yes
< less 5<3 5<3
if 5 is less than 3 no
>= greater or equal 5≥3 5>=3
if 5 is greater or equal to 3 yes
<= Less or equal 5≤3 5<=3
if 5 is less or equal to 3 no
== equal 5=3 5==3
if 5 is equal to 3 no
!= not equal 5≠3 5!=3
if 5 is not equal to 3 yes
10 слайд
operator operation Example eguation Example code result + addition 3+2 a=3+2 a=5 - substraction 3-2 a=3-2 a=1 * multiplication 3∙2 a=3*2 a=6 / dinision a=10/2 a=5 // floordivision N/A a=10//3 a=3 ** power a=2**3 a=8 % modulus N/A a=8%3 a=2 > greater 5>3 5>3 if 5 is greater than 3 yes < less 5<3 5<3 if 5 is less than 3 no >= greater or equal 5≥3 5>=3 if 5 is greater or equal to 3 yes <= Less or equal 5≤3 5<=3 if 5 is less or equal to 3 no == equal 5=3 5==3 if 5 is equal to 3 no != not equal 5≠3 5!=3 if 5 is not equal to 3 yes
11 слайд
•
Format of conditional:
a = 1
if a > 2 :
print ( "H" )
else :
print ( "L" )
a = 3
if a > 2 :
print ( "H" )
else :
print ( "L" )
11 слайд
• Format of conditional: a = 1 if a > 2 : print ( "H" ) else : print ( "L" ) a = 3 if a > 2 : print ( "H" ) else : print ( "L" )
12 слайд
•
Practice 1
Open page number 51. Do this exercise for practice.
Practice 2
Sid down at computers and do the this task ” Is the number
even?”
number = int(input( "Введите число: " )) if (number% 2 == 0 ):
print ( "Четное число" ) else : print ( "Нечетное число" )
12 слайд
• Practice 1 Open page number 51. Do this exercise for practice. Practice 2 Sid down at computers and do the this task ” Is the number even?” number = int(input( "Введите число: " )) if (number% 2 == 0 ): print ( "Четное число" ) else : print ( "Нечетное число" )