Revision

Revision
1 / 56
volgende
Slide 1: Tekstslide
Computer ScienceSecondary Education

In deze les zitten 56 slides, met interactieve quizzen en tekstslides.

Onderdelen in deze les

Revision

Slide 1 - Tekstslide

Deze slide heeft geen instructies

Slide 2 - Tekstslide

Deze slide heeft geen instructies

Slide 3 - Tekstslide

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

What would the output be for this code?

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

Slide 6 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

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 - Tekstslide

Deze slide heeft geen instructies

 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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

What does a selection statement do?

Slide 18 - Open vraag

Deze slide heeft geen instructies

if, else - Example Program 

Slide 19 - Tekstslide

Deze slide heeft geen instructies

if, else - Program Flowchart

Slide 20 - Tekstslide

Deze slide heeft geen instructies

if, else, elif - Example Program

Slide 21 - Tekstslide

Deze slide heeft geen instructies

if, elif, else Statements

Slide 22 - Tekstslide

Deze slide heeft geen instructies

if, elif, else Statements 

Slide 23 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

Comparison Operators

Slide 25 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Click here

Slide 27 - Tekstslide

Deze slide heeft geen instructies

Answer

Slide 28 - Tekstslide

Deze slide heeft geen instructies

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

Slide 29 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 36 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 39 - Tekstslide

Deze slide heeft geen instructies

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

Slide 40 - Quizvraag

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 42 - Quizvraag

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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

Slide 44 - Tekstslide

Deze slide heeft geen instructies

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

Slide 45 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

How if, elif and else statements can be used

Slide 47 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Quizvraag

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

 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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Sleepvraag

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies