Search Header Logo
Python Lists Flashcard

Python Lists Flashcard

Assessment

Flashcard

Computers

7th Grade

Practice Problem

Easy

Created by

Robo programmer

Used 2+ times

FREE Resource

Student preview

quiz-placeholder

9 questions

Show all answers

1.

FLASHCARD QUESTION

Front

In the list ["John", "Harry", "Jesse", "John", "Harry", "Harry", "Jill"], which item has the index number of 3?

Back

"John"

Answer explanation

In the list, indexing starts at 0. The item at index 3 is the fourth item, which is "John". Therefore, the correct answer is "John".

2.

FLASHCARD QUESTION

Front

The list needs one more name added to the end - "Felipe". Which piece of code below would do this? nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

Back

nameList.append("Felipe")

Answer explanation

The correct code to add 'Felipe' to the end of the list is 'nameList.append("Felipe")'. This uses the append method correctly with parentheses and quotes around the string.

3.

FLASHCARD QUESTION

Front

What output will this code produce?

Media Image

Back

red

Answer explanation

The code produces 'red' because it likely contains a condition or logic that specifically outputs 'red' based on certain criteria being met, while the other options do not match the conditions defined in the code.

4.

FLASHCARD QUESTION

Front

Is this the correct code for a list? register = {"Sam", "Pheobe", Georgia", Richard"}

Back

No

Answer explanation

No, the code is incorrect because it uses curly braces, which define a set, not a list. A list should be defined using square brackets, like this: register = ["Sam", "Pheobe", "Georgia", "Richard"].

5.

FLASHCARD QUESTION

Front

What output will this code produce?

Media Image

Back

['red', 'green', 'blue']

Answer explanation

The code produces ['red', 'green', 'blue'] because it creates a list with these three colors in that order. The other options do not match the output of the code.

6.

FLASHCARD QUESTION

Front

Which colour will be replaced with yellow?

Media Image

Back

green

Answer explanation

The question asks which color will be replaced with yellow. The correct answer is green, as it is common to replace a color in a set, while yellow is typically added to enhance the palette.

7.

FLASHCARD QUESTION

Front

Which symbols are used to open and close a list?

Back

[ ] square brackets

Answer explanation

Square brackets [ ] are used to open and close lists in programming and mathematics, distinguishing them from round brackets ( ), curly brackets { }, and speech marks " ". Thus, the correct answer is [ ] square brackets.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?