Assignment, Variables, Constants & Sequences
Inputs, Outputs & Type Conversion
Condition controlled Loops
Count Controlled loops
Nested Selection and Iteration
Subroutines 1 - Procedures
Subroutines 2 - Functions
Operators and Operations
Structured Programming
Validation and verification
Selection
Good notes will help you organise and process data and information
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.
A conditional statement is any statement that can be determined to be True or False. To make a statement conditional we use comparison operators
Look at the conditional statement in the diamond below, should we DO THIS or DO THAT?
Comparison operators are used to compare values. It either returns True or False according to the condition.
True
False
Look at the text below in Python, when we run it you can see that the if statement condition is true.
Add in this comment at the top of your page: #An if statement helps us make decisions in our code
Save your file as 'if_statements'
Can you change your code so that the variable comes from a user input?
Don't forget when we are getting a number from a user input to use int(input("Please enter a number: "))
Lets see if we can create a version of the above flowchart in python.
Sometimes we want to have more that two otions when we make a choice we can do that in python by using an elif statement.
Lets look at the learning outcomes and decide which one best describes our current level of understanding :
Tick the one you feel is closest to your level
AQA Computer Science Tutor
Guess Who
Boolean Operators
IF Statements
Python Syntax