Font size
WorksheetsWeek 14 - Tuples
Total questions: 42
Worksheet time: 31mins
Mia, Ava, and Mason are having a debate about Python data structures. Mia says both lists and tuples are mutable, Ava thinks lists are mutable whereas tuples are immutable, and Mason believes both lists and tuples are immutable. Who is correct?
Mia: List and tuples both are mutable.
Ava: List is mutable whereas tuples are immutable.
Mason: List and tuples both are immutable.
None of them: List is immutable whereas tuples are mutable
Zoe, Arjun, and Evelyn are on a treasure hunt. They found a mysterious note with a tuple c = ((7,5),(5,8),(0,-1),(4,3)). If the number 3 is the clue to the next location, how would they refer to it in the tuple?
c[0][0]
c(3)
c[8]
c[3][1]
Luna, Noah, and Evelyn are playing a game of Python trivia. Luna creates an empty tuple: y = (). Evelyn, can you tell us what is the index of this tuple?
0
1
There is none. It is an empty tuple
Anika, Nora, and Mia are having a debate. Anika says you can have an empty tuple z = () and an empty string w = []. Nora and Mia are not sure. Who is correct?
Anika
Nora and Mia
Aria, Aiden, and Isla are playing a game of 'Python Trivia'. Aiden asks, 'Given a = "Hello world", what does list(a) do in Python?' Can you help them answer?
It creates a list where each word (separated by white spaces) is an item
It creates a list where each character is an item
It does nothing
It creates a blank list named a
Liam, Lily, and Benjamin are having a debate. Liam thinks you can have lists inside of tuples and vice versa, but Lily and Benjamin aren't so sure. Who do you think is correct?
Liam
Lily and Benjamin
Imagine Kai, Lily, and Rohan are playing a game of Python trivia. Kai comes up with a tricky question:
He defines a tuple as follows:
t = ('They', 'bar', 'have', 'a', 'pepper')
He then asks, 'Which of the following Python statements would replace the second element ('bar') with the string 'quiznos'?
t[1] = 'quiznos'
t(1) = 'quiznos'
t[1:1] = 'quiznos'
It's a trick question—tuples can't be modified.
David, Ethan, and Mason are having a friendly competition to see who can count the number of elements in a list the fastest. Which function should they use to win the competition?
count( )
find( )
len( )
index( )
Sophia, Ava, and Noah are having a friendly debate about Python. They made several statements, but one of them is NOT correct. Can you spot it?
Sophia said: 'A list is mutable.'
Ava claimed: 'A tuple is immutable.'
Noah mentioned: 'The append function is used to add an element.'
Sophia argued: 'The extend function adds an element to a tuple.'
Maya, Kai, and Luna are playing a game of 'Guess the Data Type!'. Maya shows them a data structure: a=[(1,1),(2,4),(3,9)]. Can you help Kai and Luna guess what type of data this is?
Array of tuples
List of tuples
Tuples of lists
Invalid type
Sophia, Aiden, and Abigail are playing a game of 'Guess the Output'. They are trying to figure out the result of a certain program. Can you help them out?
('1', '2', '3', '4', '5')
(1, 2, 3, 4, 5)
12345
"12345"
Nora, Michael, and Avery are playing a game of Python trivia. Nora says, 'If T=("A"), then what is the type of A?' Can you help them answer?
tuple
string
int
list
Mia, Isla, and Arjun are having a friendly coding competition. They are trying to figure out how to create a single element tuple in Python. Can you help them out?
(1,)
(1)
{1}
[1]
tuple([1])
Isla, Aria, and Emma are having a friendly coding competition. They stumbled upon a program and are trying to figure out its output. Can you help them? What is the output of the program they are looking at?
<class 'tuple'>
<class 'None'>
<class 'list'>
<class 'int'>
Imagine Daniel, Oliver, and Abigail are working on a Python project together. Daniel writes the following piece of code:
>>> a=(1,2,3,4)
Then, Oliver tries to delete 'a' using the following command:
>>> del a
Abigail is unsure if this is valid. What do you think?
No, because a tuple is immutable and cannot be deleted
Yes, the entire tuple 'a' will be deleted
No, this is an invalid syntax for the del method
Yes, but only the first element in the tuple 'a' will be deleted
1. Nora, Scarlett, and Harper are having a debate. They are discussing a certain data type in Python that consists of a number of values separated by a comma and enclosed within parentheses. Can you help them identify it?
Lists
Tuples
Set
Dictionary
Ethan, Isla, and Grace are on a treasure hunt. They found a mysterious note that says, 'The elements of a secret code are enclosed by ________.' They need your help to solve this. What do you think the answer is?
array bracket
square brackets
parenthesis
Curly brace
3. Imagine Luna, Benjamin, and Rohan are playing a game of Python trivia. Luna asks, 'Which function would you use to create Tuples from a list?' What would your answer be?
tuple
set()
list()
tuple( )
7. Samuel, Maya, and Isla are playing a game of 'Tuple Tower'. In this game, when they stack a tuple inside another tuple, each tuple is considered as a separate what?
element
variable
parameter
none of these
10. James and Arjun are having a friendly coding competition. They are trying to delete an entire tuple. Which command should they use to achieve this?
remove
delete
del
erase
Abigail, Ethan, and Michael are playing a game of 'Symbol Masters'. In their game, the symbol + in a string means what?
It's a secret code for addition
It's a magic spell to swap places
It's a special move for concatenation
It's a power booster for multiplication
Elijah, Ava, and Anika are playing a game of 'Python Trivia'. Elijah asks, 'A tuple in Python looks like a list, but what do we use instead of square brackets?'
parentheses
square brackets
curly braces
Mia, Kai, and Anika are having a friendly competition to see who knows the most about Python tuples. They are discussing which methods cannot be used with tuples. Can you help them out?
append()
len()
insert()
remove()
Arjun, Abigail, and Rohan are having a friendly competition to see who knows Python the best! They're currently discussing tuples. Can you help them figure out which methods cannot be used with tuples?
pop()
max()
min()
sort()
Olivia, Harper, and Lily are having a friendly competition to see who knows Python the best! They stumbled upon a question about tuples. Can you help them figure out which method cannot be used with tuples?
sum()
sorted()
reverse()
count()
Priya, Aria, and Kai are having a friendly competition to see who can come up with the most functions that can be used with both lists and tuples. Can you help them out?
len()
append()
sorted()
sort()
Imagine Abigail, Jackson, and William are creating a magical spell in their Python wizardry class. The spell requires them to create a tuple with a single element. Do they need to add a comma (,) after the single element?
Yes, they do
No, they don't
Aria and David are having a friendly debate. Aria says that 'T = tuple(L)' will convert a list into a tuple. David is not so sure. Who do you think is correct?
Aria
David
Aria, Arjun, and Ava are having a friendly debate about Python string formatters. They are trying to figure out what curly braces {} are known as. Can you help them settle this?
Placeholders
Variables
Replacement Fields
Options
Imagine Olivia, Elijah, and Harper are in a coding class. They come across an 's' in string formatting. Olivia thinks it's because they are using strings, Elijah thinks it's for decimal integers, Harper thinks it's for floats, and their teacher thinks they are just using the letter s. Who is correct?
Olivia
Elijah
Harper
Their teacher
Ethan, Zoe and Harper are playing a game of 'Python Trivia'. Ethan draws a card and reads out the question, 'When we use a 'd' in string formatting, what are we indicating?' Can you help them answer?
It means we are using strings.
It signifies we are using decimal integers.
It indicates we are using floats.
It suggests we are using the letter s.
James, Ava, and Emma are having a debate. James says that when we use an 'f' in string formatting, we are using strings. Ava thinks we are using decimal integers. Emma believes we are using floats. Who is correct?
James, who thinks we are using strings.
Ava, who thinks we are using decimal integers.
Emma, who thinks we are using floats.
None of them.
Avery, Aria, and James are playing a game of 'Guess the Number Format'. Avery is given the number 75.765367 and the format :.3f. Can you help Avery guess how the number will look like in this format?
76
75.76
75.765
75.7653
Imagine Jackson, Abigail, and Evelyn are playing a game of 'Guess the Number'. Jackson types :.0f in a string formatter and the number 75.765367 pops up. Can you guess how this number will look like to Evelyn?
76
75.76
75.765
75.7653
Aria, Benjamin, and Liam are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.0d in a string formatter, what will the number 75.765367 look like?
76
75.76
75.765
ValueError
Imagine Lily, Ava, and Elijah are playing a game of Python trivia. Lily draws a card that reads, '{0:4} in a string formatter, what does the second part indicate?'
Field Size
Position
Index Number
What we are entering in.
Aria, Michael, and Noah are playing a game of coding trivia. They come across a question: "What do these symbols in a string formatter "<, >, ^" represent?" Can you help them answer?
An Error
Math
Alignment
Field Size
Oliver, Emma, and Mia are playing a game of 'Python Trivia'. Oliver asks, 'What is the output of the following Python code: print(type(()))?' Can you help them answer?
<class 'tuple'>
<class 'None'>
<class 'list'>
<class 'int'>
Lucas, Ava, and Sophia are having a debate. Lucas says that in Python, you can concatenate two tuples using the '+' operator. Ava and Sophia aren't so sure. Who do you think is correct?
Lucas
Ava and Sophia
Imagine Noah, Isabella, and Mia are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.2f in a string formatter, what will the number 123.456 look like?
123
123.45
123.456
123.46
Emma, Aiden, and Ava are having a friendly debate about Python. Emma says that in Python, you can change the value of a tuple. Aiden and Ava aren't so sure. Who do you think is correct?
Emma
Aiden and Ava
Oliver, Sophia, and Harper are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.4f in a string formatter, what will the number 123.456789 look like?
123
123.45
123.4567
123.4568
