Log in
Sign up for FREE
arrow_back
Library

L1 Python KPRIDE: Output, Input and Variables

star
star
star
star
star
Last updated 9 months ago
13 questions

Learning Objectives:

  • I can tell someone what an algorithm is
  • I know how to create a simple Python Program (Input and Output)
  • I can explain and debug an algorithm/Python Program

For GCSE, you must know the following for programming:

  • Outputs and Inputs
  • Variables
  • Maths Operators
  • Random numbers
  • Strings and Casting
  • Booleans
  • If, elif, else
  • Nested Ifs
  • For loops
  • While loops
  • Nested loops
  • Arrays/Lists
  • 2D Lists
  • File handling
  • Subprograms(functions/procedures)

Warm-up Practice:
https://type.withcode.uk/python/Variables_and_Constants

Keywords

  1. Input - Taking data from the user to the computer
  2. Output - Sending data back to the user (such as sound, text, or changes to the screen)
  3. Variable - A name that has a value that can change when the program is running (such as a score)
  4. Algorithm - An order set of step-by-step instructions to solve a problem
  5. Debug - Finding and fixing problems in your code

Predict and Run

Look at the code for each question.
What do you think will be the output?
What is the actual output?
1
1
1
1
1
1
1

Investigate

  1. Look at the code on the right.
  2. Run it and see what it does.
  3. Click on the pencil icon at the top to see the code again.
  4. Change "12" to another number.
  5. What happens if you get rid of the Speech marks""? Does it still work?

Debug

Click on each link and try dragging and dropping code into the correct order
https://7strikelink7.github.io/NormalPythonParsons/parsons/Outputs.html
https://7strikelink7.github.io/NormalPythonParsons/parsons/Variables.html
https://7strikelink7.github.io/NormalPythonParsons/parsons/Inputs.html

Extend

Help:
print ( ) is used to output text
input( ) is used to get the user to type something

Variables store values that can change.
Name = Value here
e.g. myName = "John"
1
Question 8
8.

Make a program to output
"Good morning, user!"

1
1
1
1
1
Question 1
1.

What do you think will be the output to this code:

print ("Hello World")

Question 2
2.

What will be printed by the following code:

print(5 + 3)?

Question 3
3.

What will be printed by the following code:

print('Hello' + ' World')

Question 4
4.

What will be printed by the following code:

print(10 - 2)

Question 5
5.

What will be printed by the following code:

print(2 * 4)

Question 6
6.

What will be printed by the following code:

myName = "Amy"
print(myName)

Question 7
7.

What will be printed by the following code:

myAge = input("How old are you?")

Question 9
9.

Ask the user for their first name.
Then display "Hello" to the user with their name.
Hello [first name]

Question 10
10.

Make a program to create a variable called myAge. Display "I am also age years old!"
Enter your age: 12
I am also 12 years old!

Question 11
11.

Ask the user for their first name and their surname/last name. Display "Hello" with their full name
Hello [first name] [last name]

Question 12
12.

Ask the user for two numbers. Then add them both. Display the total.
Number 1: 5
Number 2: 3
Outputs: 8

Question 13
13.

CHALLENGE:

Ask the user for three numbers. Add the first two together and divide by the third number. Output the result
Number 1: 5
Number 2: 3
Number 3: 2
Number 1 + number 2 = 8
8 / Number 3 = 2