If Statements in Python: Making Decisions with Code
If Statements in Python: Making Decisions with Code
1 / 13
volgende
Slide 1: Tekstslide
In deze les zitten 13 slides, met interactieve quizzen en tekstslides.
Onderdelen in deze les
If Statements in Python: Making Decisions with Code
Slide 1 - Tekstslide
Deze slide heeft geen instructies
Learning Objective
At the end of the lesson, you will be able to write and use if statements in Python to make decisions in your code.
Slide 2 - Tekstslide
Introduce the learning objective and explain why it's important for students to learn if statements.
What do you already know about decision-making using code?
Slide 3 - Woordweb
Deze slide heeft geen instructies
What are If Statements?
If statements are used to make decisions in code. They allow your program to take different actions based on whether a condition is true or false.
Slide 4 - Tekstslide
Explain the concept of if statements and provide a simple example.
Syntax of If Statements
The syntax of an if statement in Python is: if condition: code to execute if condition is true
Slide 5 - Tekstslide
Explain the syntax of if statements and provide an example.
Using Comparison Operators
To create conditions in if statements, you can use comparison operators such as == (equal), != (not equal), > (greater than), < (less than), >= (greater than or equal to), and
Slide 6 - Tekstslide
Explain the different comparison operators and provide examples.
Else Statements
Else statements allow you to provide an alternative action to take if the condition in the if statement is false. The syntax is: if condition: code to execute if condition is true else: code to execute if condition is false
Slide 7 - Tekstslide
Explain the concept of else statements and provide an example.
Elif Statements
Elif statements allow you to specify additional conditions to check if the first condition is false. The syntax is: if condition: code to execute if condition is true elif condition2: code to execute if condition2 is true else: code to execute if all conditions are false
Slide 8 - Tekstslide
Explain the concept of elif statements and provide an example.
Nested If Statements
You can also nest if statements inside other if statements to create more complex conditions. The syntax is: if condition1: if condition2: code to execute if both conditions are true
Slide 9 - Tekstslide
Explain the concept of nested if statements and provide an example.
Practice Problems
Practice using if statements by completing the following problems:
Slide 10 - Tekstslide
Provide practice problems for students to complete and encourage them to ask questions if they need help.
Write down 3 things you learned in this lesson.
Slide 11 - Open vraag
Have students enter three things they learned in this lesson. With this they can indicate their own learning efficiency of this lesson.
Write down 2 things you want to know more about.
Slide 12 - Open vraag
Here, students enter two things they would like to know more about. This not only increases involvement, but also gives them more ownership.
Ask 1 question about something you haven't quite understood yet.
Slide 13 - Open vraag
The students indicate here (in question form) with which part of the material they still have difficulty. For the teacher, this not only provides insight into the extent to which the students understand/master the material, but also a good starting point for the next lesson.