Font size
WorksheetsPython 101
Total questions: 104
Worksheet time: 52mins
Why is Python called Python?
Its cos its cool
Guido van Rossum was reading Python script and wanted a unique name.
It was devised using an algorithm.
I don't know.
There are two parts to Python programming
The Shell and New files
Head and the Tail
The inside and the outside
In Python programming what does the shell do?
It lets you test out what your program will do
Lets you write it and save it.
What is the image an example of in Python?
New file
Shell
In Python programming what does the the new file do?
It lets you test out what your program will do
Lets you write it and save it then you can test it in the shell
What is python?
A programming language
A code
Nothing
A game
What is a variable?
Its a special kind of ball.
Its something that can have a value assigned to it - like a response to a question.
Its something to do with something.
I don't know.
What would the following print statement do?
print("Good Morning Class")
Display print("Good Morning Class")
Display Good Morning Class
Do nothing there is no capital P
Which of the following lines of code is the correct one?
Print ("Good Morning Class")
Print "Good Morning Class"
print ("Good Morning Class")
print ("Good Morning Class)
What is wrong with this line of code?
print ("Good Morning Class)
Has a small letter for the word print.
Missing a bracket at the end of the code.
It doesn't have an equals between the variable and the code.
Missing the speech marks at the end of the text.
What is wrong with this line of code?
Print ("Good Morning Class")
Has a capital letter for the word print.
Missing a bracket at the end of the code.
It doesn't have an equals between the variable and the code.
Missing the speech marks at the end of the text.
What is the image an example of in Python?
New file
Shell
What is a integer?
It is a piece of text
It is a whole number
It is a decimal number
It is a true or false answer
What is a real?
It is a piece of text or a character.
It is a whole number
It is a decimal number
It is a true or false answer
What is Boolean?
It is a piece of text or a character.
It is a whole number
It is a decimal number
It is a true or false answer
What is the symbol used when adding the string input from a user to a printed statement?
+ (plus)
, (comma)
Why do you sometimes need to include (str) next to a number?
Because you want to turn it into a integer rather than a string
Because you want it to be turned into a string rather than be an integer
Because that is what the teacher said
What is the symbol used when adding the integer input from a user to a printed statement?
+ (plus)
, (comma)
Why do you sometimes include int(input(...))?
Because you want to turn the entered information into a integer rather than a string
Because you want to turn the entered information into a string rather than a integer
Because that is what the teacher said
Which of the following code would you use to find out the length of a word?
HELP!!
word.length
find length word
len(word)
Which symbol do you use to turn the rest of the line into a comment or to have the program skip over it?
@
£
?
#
What colour should the text go if it has been turned into a comment?
Blue
Green
Yellow
Red
If Star Wars was put as answer what would be the response?
Nothing
"What's Star Wars?"
"May the force be with you"
"Let it go!"
If I were to put in the answer of "Cardiff" which reponse would I get back?
Incorrect
Correct
Python language was developed in what year?
1985
2001
1991
1820
Is python an interpreter or compiler programming language?
Compiler
Interpreter
Python uses indentation to block code into chunks
True
False
Python is a
text language
database language
programming language
Comments in Python are written with a special character, which one?
brackets
hashtag
coma
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
If you want to create an empty list called colours in Python, which of the following is correct?
colours = [ ]
colours = ( )
colours = { }
colours = <>
What will the output be from the following code?
print(3+4)
3+4
7
SyntaxError
print(3+4)
What would this print?
What will the output be from the following Python code?
print(Hello world!)
Hello world!
SyntaxError
Hello world
print(Hello world!)
What is the Python built-in function to converts a number to a string?
str()
int()
parseInt()
convert
Which of these is correct Python conditional statement?
IF answer == "Yes":
if answer == "Yes"
if answer == "Yes":
if answer = "yes":
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
x = 5
y = 6
print("x*y")
The code above displays the following:
11
x*y
Syntax Error
30
cakeAmount = input()
print "We have", cakeAmount, " cakes"
The above code is run. You type:
six
Select the correct output.
We have 6 cakes
We have six cakes
Error
A String is a list of what?
Shapes
Characters
Symbols
Letters
When finding the length of a String, how will the result be displayed?
As a Real Number
As an Integer
As a Boolean Value
As a Description
what is a string?
any numeric value
any float value
any character value
any special symbol value
how we store string value in variable?
'string'
"string"
%string%
#sring#
The pseudocode below assigns two strings to two variables:
title = "computer science"
level = "gcse"
What would the Python code: len(level) return?
2
3
4
1
The pseudocode below assigns two strings to two variables:
title = "computer science"
level = "gcse"
What is title[0]?
'c'
'o'
'g'
An error
The pseudocode below assigns two strings to two variables:
title = "computer science"
level = "gcse"
What is level[3]?
'g'
'e'
'c'
's'
Fruits = ["Apple","Pear","Orange","Grape","Pineapple",'Pen"]
What will be displayed if I type in:
print(Fruits[2])
Orange
Apple
Pear
Grape
When talking about lists, what does append mean?
Add a value to the end of a list
Add a value to the begining of a list
Add the word pen to a list
Print out the list
What does this line of code do?
Fruits.reverse()
Reverse the order of a list
Put a list into alphabetical order
Put a list into numerical order
Doesn't do anything a list
In an list, what is the first numbered position in which data can be stored?
Position 0
Position 1
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
What is used to separate elements in a list?
Bracket
Comma
Full Stop
Space
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
An empty list can be declared as
fruitList = ""
fruitList = ["empty"]
fruitList == []
fruitList = []
What is a loop?
A loop without conditions
A loop with an if statement
In computer programming, a loop is an order of instructions that repeats for many times
Should this be a loop?
No, because there is no pattern.
Yes, because every middle square has honey or nectar.
The action of doing something over and over again.
Looping
Bugging
Programming
What is the action of doing something over and over again?
Repeat
Loop
Debugging
What does run mean?
to make a code for a program
to make a program complete an algorithm
to make a website show up on your screen
Is there more than one way to code a puzzle?
No
No, but you can make up your own design
Yes
Yes, but it will be counted wrong
What does this code do?
Moves forward 1 time
Moves forward forever
Moves forward 5 times
Moves left
What shape does this code make?
Rectangle
Triangle
Square
Circle
In coding terms an action or event you want to repeat multiple times is called a
loop
do-over
sequence
Infinite loops are also called _________ loops.
endless
forever
never ending
A forever loop is a code pattern that repeats ___________________ .
as long as the program is running
for a set number of times
until a condition is met
An action that causes something to happen.
A loop.
A program.
An event.
Look at the following code, what will it generate
1,2,3,4,5,6,7,8,9,10,11,12
0,1,2,3,4,5,6,7,8,9,10,11,12
1,2,3,4,5,6,7,8,9,10,11,12,13
0,1,2,3,4,5,6,7,8,9,10,11,12,13
What does the following program display?
1,2,3,4
1,2,3,4,5
counter,counter,counter,counter,counter
0,1,2,3,4,5
When do you know when you come to the end of the loop?
Its states End loop
The command End is given
The indentation stops
A part of the program that does not work correctly.
Bug
Break
Loop
How long are the sides of this shape?
2 pixels
120 pixels
150 pixels
Purple pixels
Which of the following means not equal to
==
!=
>
=
Why are arrows used in flowcharts
To show a statement is equal to another
To allow the computer to run the program
To indicate a flow of direction
To make them look nice
Which of these is the python code for 'then'
>
<
∞
:
4
3
2
1
3
2
1
0
What is the variable in this for loop?
x
(6)
for
range
A condition is
a statement that is either True or False
a string
an integer
a list
Which kind of loop would be used?
I need a program that will keep letting me add a monthly payment for 12 months.
FOR Loop
WHILE Loop
