Revision

Revision
1 / 56
suivant
Slide 1: Diapositive
Computer ScienceSecondary Education

Cette leçon contient 56 diapositives, avec quiz interactifs et diapositives de texte.

Éléments de cette leçon

Revision

Slide 1 - Diapositive

Cet élément n'a pas d'instructions

Slide 2 - Diapositive

Cet élément n'a pas d'instructions

Slide 3 - Diapositive

Cet élément n'a pas d'instructions

What is the correct version of code?
A
print("Hello World")
B
print"(Hello World")
C
print((Hello World))
D
print(Hello World")

Slide 4 - Quiz

Cet élément n'a pas d'instructions

What would the output be for this code?

myname = "bob"
name = input("please enter your name: ")
print(myname)
A
bob
B
name
C
john
D
myname

Slide 5 - Quiz

Cet élément n'a pas d'instructions

What would the output be for this code?

food = "pizza"
print("orange")
A
print pizza
B
food
C
orange
D
pizza

Slide 6 - Quiz

Cet élément n'a pas d'instructions

What is programming?
A
The order in which we write our code.
B
The programs we use.
C
A set of instructions to complete a task.
D
The result of our program when run.

Slide 7 - Quiz

Cet élément n'a pas d'instructions

What is sequencing?
A
A set of instructions.
B
A set of instructions in order.
C
A program created by code.
D
The result of our program when run.

Slide 8 - Quiz

Quiz should take 3-4 mins, allow time on later questions for students to read through the code options to figure out which option is correct. 
To review the concepts of Programming
I feel confident in answering questions about computer programming

Slide 9 - Diapositive

Cet élément n'a pas d'instructions

 Variable
A variable is a named storage location in a computer's memory that can hold a value. The value stored in a variable can be changed throughout the program's execution, hence the term "Variable".

Slide 10 - Diapositive

Cet élément n'a pas d'instructions

Variables 
  • In programming, a variable is like a container that holds a piece of information. This information can be anything, like a number, a word, or even a whole sentence!
  • For example, imagine you have a box that can hold a piece of fruit. You can put an apple in the box, and then later on, you can take the apple out and look at it. In programming, a variable is like that box. You can put information into the variable, and then you can use that information later on in your program.
  • To use a variable, you first need to give it a name. This is like labelling the box with the word "apple" so you know what's inside. In programming, you can choose any name you want for your variable, as long as it follows certain rules. For example, the name can't have spaces in it, and it can't start with a number.



Slide 11 - Diapositive

Cet élément n'a pas d'instructions

Task 3 - Variables
We are now going to create a variable and then save some data to it. We will then output "print" this data to the screen.

Press the green play button to execute the code.

Slide 12 - Diapositive

Cet élément n'a pas d'instructions

Task 4 : Create an adventure using inputs, outputs and variables to create a story!

Can you create a story like the one below - feel free to change the questions!

Slide 13 - Diapositive

Cet élément n'a pas d'instructions

Variables 
  • In programming, a variable is like a container that holds a piece of information. This information can be anything, like a number, a word, or even a whole sentence!


  • For example, imagine you have a box that can hold a piece of fruit. You can put an apple in the box, and then later on, you can take the apple out and look at it. In programming, a variable is like that box. You can put information into the variable, and then you can use that information later on in your program.





Slide 14 - Diapositive

Cet élément n'a pas d'instructions

Task 3 - Variables
We are now going to create a variable and then save some data to it. We will then output "print" this data to the screen.

Press the green play button to execute the code.

Slide 15 - Diapositive

Cet élément n'a pas d'instructions

What type of information can be stored in a variable?
A
Only videos
B
Only sounds
C
Only pictures
D
Numbers, text, and other types of data

Slide 16 - Quiz

Cet élément n'a pas d'instructions

Selection Statements
Selection allows us to make decisions in our programs.  The code we use, are IF statements.
eg. IF I want to play on my PS5 THEN
I need to switch the PS5 on
Else I leave the PS5 switched off.


Slide 17 - Diapositive

Cet élément n'a pas d'instructions

What does a selection statement do?

Slide 18 - Question ouverte

Cet élément n'a pas d'instructions

if, else - Example Program 

Slide 19 - Diapositive

Cet élément n'a pas d'instructions

if, else - Program Flowchart

Slide 20 - Diapositive

Cet élément n'a pas d'instructions

if, else, elif - Example Program

Slide 21 - Diapositive

Cet élément n'a pas d'instructions

if, elif, else Statements

Slide 22 - Diapositive

Cet élément n'a pas d'instructions

if, elif, else Statements 

Slide 23 - Diapositive

Cet élément n'a pas d'instructions

Indentation
  • You may notice in my code, that some of the lines have been indented.
  • There is a reason for this.
  • Python requires indentation for the syntax.
  • Indentation signifies the start and end of a block of code.
  • Programs will not run.

Slide 24 - Diapositive

Cet élément n'a pas d'instructions

Comparison Operators

Slide 25 - Diapositive

Cet élément n'a pas d'instructions

Challenge Time!
Scenario
Age must be 18 to go into a club.
I want to go to a club, but I want to check whether I am old enough. If I am old enough, the program must say "You can go to the party" and if I am not old enough, the program must say, "You can't go to the party".

Comparison Operator you must use is -  >=

Slide 26 - Diapositive

Cet élément n'a pas d'instructions

Debugging Task
Can you find out what is wrong with the code?

Click here

Slide 27 - Diapositive

Cet élément n'a pas d'instructions

Answer

Slide 28 - Diapositive

Cet élément n'a pas d'instructions

What is the comparison operator for not equal to?
A
!=
B
<=
C
>=
D
==

Slide 29 - Quiz

Cet élément n'a pas d'instructions

What is a loop?
A
A set of instructions to complete a task.
B
A set of instructions in order.
C
A repeated section of code.
D
The end result of your program.

Slide 30 - Quiz

Cet élément n'a pas d'instructions

Why do we use loops in your programs?
A
To make the program run faster.
B
To make the program more efficient.
C
They allow decisions to be made.
D
They put information onto the screen,

Slide 31 - Quiz

Cet élément n'a pas d'instructions

What is a conditional statement?
A
A decision in a program.
B
A section of the program that loops.
C
A set of instructions in order.
D
An error in the code.

Slide 32 - Quiz

Cet élément n'a pas d'instructions

What is Syntax?
  • The way we write a line of code is important, as the computer needs to recognise it.
  • Think about our 'English'. It is important that we use correct punctuation, such as Commas and Full Stops. If we didn't, it would make our writing difficult to read.
  • If we do not use the correct symbols and spellings in our Python coding, then the computer will not be-able to run our programs.


Slide 33 - Diapositive

Cet élément n'a pas d'instructions

Task 2 - Debugging
In this task, you will need to debug the code using the error messages that create with code provide.

Click here

Slide 34 - Diapositive

Cet élément n'a pas d'instructions

What is debugging?
  • Debugging code refers to the process of identifying and fixing errors, bugs, or defects in a computer program that we have created.

  • An error occurs, when you have done something wrong in your program. You could have spelt something wrong or even missed out a symbol...

Slide 35 - Diapositive

Cet élément n'a pas d'instructions

Debugging Continued...
Create with code, shows you where your error is. Below is a screenshot that shows this.

Slide 36 - Diapositive

Cet élément n'a pas d'instructions

What is debugging?
  • Debugging code refers to the process of identifying and fixing errors, bugs, or defects in a computer program that we have created.

  • An error occurs, when you have done something wrong in your program. You could have spelt something wrong or even missed out a symbol...

Slide 37 - Diapositive

Cet élément n'a pas d'instructions

Task 2 - Debugging
In this task, you will need to debug the code using the error messages that create with code provide.

Click here

Slide 38 - Diapositive

Cet élément n'a pas d'instructions

Debugging Continued...
Create with code, shows you where your error is. Below is a screenshot that shows this.

Slide 39 - Diapositive

Cet élément n'a pas d'instructions

What is the process of checking a program for errors?
A
Error checking
B
De-bugging
C
Error finding
D
Mistake finding

Slide 40 - Quiz

Cet élément n'a pas d'instructions

Commenting our code. What is the importance?
  • By commenting our code,  it tells you (the programmer) and anyone else who looks at the code what it does.

  • By using the '#' symbol, it will not display when your code has been run.

Below is an example


Slide 41 - Diapositive

Cet élément n'a pas d'instructions

What is the process of checking a program for errors?
A
Error checking
B
De-bugging
C
Error finding
D
Mistake finding

Slide 42 - Quiz

Cet élément n'a pas d'instructions

What type of information can be stored in a variable?
A
Only videos
B
Only sounds
C
Only pictures
D
Numbers, text, and other types of data

Slide 43 - Quiz

Cet élément n'a pas d'instructions

Recap: Operators
The below are essential when programming...

Slide 44 - Diapositive

Cet élément n'a pas d'instructions

Let's take a look at the actual program...

Slide 45 - Diapositive

Cet élément n'a pas d'instructions

Let's look at why the program doesn't work properly!
Click here


'Make the students aware of data type casting'. This example is altered to show them!

Slide 46 - Diapositive

Cet élément n'a pas d'instructions

How if, elif and else statements can be used

Slide 47 - Diapositive

Cet élément n'a pas d'instructions

Can you...
Can you create your own program that uses if, elif and else?

I want you to create a program where:

If - you enter your name it prints("That is an awesome name")
elif - you enter John it prints("That is a good name")
elif - you enter Harry it prints("That is an ok name")
else - it prints("That isn't a good name")

Slide 48 - Diapositive

Cet élément n'a pas d'instructions

What is Syntax?
  • The way we write a line of code is important, as the computer needs to recognise it.


  • If we do not use the correct symbols and spellings in our Python coding, then the computer will not be-able to run our programs.


Slide 49 - Diapositive

Cet élément n'a pas d'instructions

What are conditional statements used for?
A
Breaking the code
B
Printing out all possible options
C
Making decisions based on certain conditions
D
Making the code run faster

Slide 50 - Quiz

Cet élément n'a pas d'instructions

Algorithm Efficiency
Efficiency is crucial in computer science. It involves measuring the performance and resource usage of algorithms. We will explore different measures and methods to assess efficiency.

Slide 51 - Diapositive

Cet élément n'a pas d'instructions

Measuring Efficiency
Efficiency can be measured using time complexity and space complexity. Time complexity examines the time taken by an algorithm, while space complexity evaluates the amount of memory used.

Slide 52 - Diapositive

Cet élément n'a pas d'instructions

 Big O Notation
Big O Notation describes the upper limit of the time complexity of an algorithm, indicating how the runtime of the algorithm grows as the size of the input data increases.
  

Slide 53 - Diapositive

Cet élément n'a pas d'instructions

Why do we use Big O Notation
Used to analyse the efficiency of a search algorithm, such as demonstrating that binary search has a time complexity of O(log n).

Slide 54 - Diapositive

Cet élément n'a pas d'instructions

CORRECT
CAUSE AN ERROR
print = ("Hello")
Print("Yes!")
print("this one)
name = imput("what is your name")
name = input("what is your name")
print("this text")
fav colour = "Green"
age = 10
print("Hello", name)
print("Bye",name")

Slide 55 - Question de remorquage

Cet élément n'a pas d'instructions

Commenting our code. What is the importance?
  • By commenting our code,  it tells you (the programmer) and anyone else who looks at the code what it does.

  • By using the '#' symbol, it will not display when your code has been run.

Below is an example


Slide 56 - Diapositive

Cet élément n'a pas d'instructions