Font size
WorksheetsYear 8 Python
Total questions: 30
Worksheet time: 15mins
print(“hello world”)
This code will work
This code will not work
print(hello world)
This code will work
This code will not work
print("Hello World")
This will print "Hello World" to the display
This code will not work
print(12 + 13)
will output...
25
1213
12 + 13
Error
print("12 + 13")
will output...
25
1213
12 + 13
Error
print("12" + "13")
will output...
25
1213
12 + 13
Error
print("12" + "13)
will output...
25
1213
12 + 13
Error
print(“Hello \n World”)
What does the \n part do?
Creates a new line
Nothing at all
Creates an error
Creates a space
You can create a new line with a special character when using the print function. What is it?
\t
\s
\n
\b
Back slash?
/
\
Forward slash?
/
\
message = “Hello World”
print(message)
Prints "Hello World"
Prints "Message"
Prints "message"
The code will not work
message = Hello World
print(message)
Prints "Hello World"
Prints "Message"
Prints "message"
The code will not work
message = "Hello World"
print(Message)
Prints "Hello World"
Prints "Message"
Prints "message"
The code will not work
temperature = 18
temperature = temperature + 1
print(temperature)
18
19
"temperature"
This code will not work
Create a variable called "city" with the value of "Hull"
city = "Hull"
city = Hull
"city" = "Hull"
city == "Hull"
Create a variable called "name" with the value of "John"
name = "John"
name = John
name = "john"
name == "John"
What symbol is used to multiply?
x
*
/
=
What symbol is used to divide?
x
*
/
=
What is a variable?
A place in the memory you can use to store data
A function such as print() that you can use in your program
Something that can vary
A hidden part of the computer that can change what your program does
Variables must NOT...
Have spaces in their names
Have names beginning with a number
Use capital letters
Have reserved names like "print" and "input"
What value will this program output?
10
15
25
30
55
What value is stored in variable 'x'?
10
15
25
30
55
What value is stored in variable 'y'?
10
15
25
30
55
What value is stored in variable 'a'?
10
15
25
30
55
What value is stored in variable 'b'?
10
15
25
30
55
How many variables are there in this program?
2
4
5
Will this program work?
Yes
No
What is the name of the variable used in this program?
input
answer
Joe runs this program and types in his name when asked. What will be the output?
Hello name
Hello Joe
Hello, Joe
Hello + name
