NEW
Font size
WorksheetsGCSE Python Legends
Total questions: 45
Worksheet time: 23mins
What has been created here?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
An Array / List
A Loop
A Value
How many elements exist in here?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
5
4
6
What is the highest index value here?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
4
5
6
What is the range of indexes for the elements here?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
0 - 4
1 - 5
0 - 5
How do we add another new sport in to here at the end?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
Sport.append("Swimming")
Sport = "Swimming"
Sport[1] = "Swimming"
How do we print "Tennis" to the display?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
print(Sport[2])
print(Sport[3])
print(Sport)
How do we print "Quidditch" to the display?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
print (Sport[4])
print (Sport[3])
print (Sport[5])
What will this code print to the display?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
Sport[0] = "Fishing"
Sport.append("Boxing")
print(Sport)
"Fishing","Rugby","Tennis","Netball","Quidditch","Boxing"
"Football","Rugby","Tennis","Netball","Quidditch"
"Fishing","Football","Rugby","Tennis","Netball","Quidditch","Boxing"
What will this code print to the display?
highscore = [125,63,35,12]
for counter in range(4):
print(highscore[counter])
125
63
35
12
63
35
12
125,63,35,12
125,63,35,12
125,63,35,12
125,63,35,12
What will this code print to the screen?
Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]
print("My Favorite Sport is: ",Sport[4])
My Favorite Sport is: Quidditch
My Favorite Sport is: Netball
My Favorite Sportis : Sport4
What are the three main data types we use in programming?
Integer, String, Float
Integer, String, Word
Integer, Character, Float
What data type should this be stored as:
£100.00
Float
Int
Str
What data type should a password be saved as if you have to use a mix of letters, numbers and special characters?
String
Integer
Float
When we join strings together we call it?
Concatenation
Addition
Merging
NewNumber = int (Number)
Casting
Concatenation
Inputting
if choice.upper() == "I":
print("You smell funny")
elif choice.upper() == "C":
print("You look lovely today")
else:
print("Invalid response")
Why did the programmer use .Upper in this code?
Just in case someone input a lower case letter it will still work
Just in case someone input an upper case letter to make it work
What will this program print to the display when it is Run?
for counter in range(5):
print(counter)
input("\nPress ENTER to exit program")
0
1
2
3
4
Press ENTER to exit program
0
1
2
3
0
1
2
3
4
5
Press ENTER to exit program
What is wrong with this IF statement when I enter 45 as my number?
Number = input("Enter a Number Please")
If Number > 5:
print ("Number is greater than 5")
If Number >10:
print ("Number is greater than 10")
else:
print("Number is less than 5")
A number greater than 10 will still print "Number is greater than 5" because the condition comes first.
A number greater than 10 will never print "Number is greater than 5" because the condition comes first.
What is wrong with this IF statement looking at the syntax?
Number = input("Enter a Number Please")
If Number < 5:
print ("Number is less than 5")
If Number <10:
print ("Number is less than 10")
There is no else statement for any other result that happens
It will not print Number is less than 10 if I enter 8
My program is supposed to add 2 and 2 to give 4. But it gives the answer 22. What type of error is this?
Logic
Syntax
Runtime
An IF statement is an example of ....
Selection
Iteration
Sequence
A FOR or WHILE loop statement is an example of ....
Selection
Iteration
Sequence
A list of instructions in order is an example of ....
Selection
Iteration
Sequence
What error prevents your program from even running?
Syntax
Logic
Spelling
What will this code produce?
Animal = "Fish"
FOR i in "Animal":
print("I am a", (Animal))
I am a Fish
I am a Fish
I am a Fish
I am a Fish
I am a Fish
I am a Animal
print("Hello world!\nHello world!")
Hello world!
print("Hello" + str(2) + "world!")
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
print(Hello world!)
print("Hello world!" * 2)
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
