Computing
Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Lesson Video

16

Lesson Tasks

  • Watch the Lesson video
    Make notes on your notes sheet.
  • Read the lesson notes
    Make notes on your notes sheet.
  • Complete the learning activities
    Make any notes on your notes sheet.
  • Check the Learning outcomes
    Update your learning objectives

What do I need to Learn?

I need to learn how to understand and know how to use Iteration in a computer program.
I need to learn how to understand and know how to use Nested selection in a computer program.
I need to learn how to understand and know how to use Nested iteration in a computer program.

Key Terms

Iteration Selection Condition Nesting While loop For loop

Learning selection in Python

In Python The 'if' statement is used to conditionally execute a statement. In other words we look at a statement(conditional) and decide if that conditional statement is true or false,we then do one thing when the condition is true and something else when the condition is false.

Lets see if we can create a version of the above flowchart in python.


If Then Else if

The code below shows you how you can make a simple quiz using an elif statement


Writing a quiz

If we want to have more than two otions when we make a choice, we can do that in python by using an elif statement.

The code below is an example of set of choices for a quiz

Task

1. Create a quiz with 5 questions, the quiz should be about python?

Extension ideas to make the quiz better

  • Make a variable to keep score of the correct answers?
  • Print out the correct answer when the answer is wrong?
  • Print out the the score out of 5 when the quiz is over?
  • Have a different statement depending on the score the person got

Update your objectives

control