List Examples Flashcards

1
Q

a = [“apple”, “banana”, “cherry”]

b = [“Ford”, “BMW”, “Volvo”]

a.append(b)

print(a)

A

[‘apple’, ‘banana’, ‘cherry’, [“Ford”, “BMW”, “Volvo”]]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

x = fruits.count(“cherry”)

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

fruits = [1, 4, 2, 9, 7, 8, 9, 3, 1]

x = fruits.count(9)

print(x)

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

cars = [‘Ford’, ‘BMW’, ‘Volvo’]

fruits.extend(cars)

A

[‘apple’, ‘banana’, ‘cherry’, ‘Ford’, ‘BMW’, ‘Volvo’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

points = (1, 4, 5, 9)

fruits.extend(points)

A

[‘apple’, ‘banana’, ‘cherry’, 1, 4, 5, 9]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

x = fruits.index(“cherry”)

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

fruits = [4, 55, 64, 32, 16, 32]

x = fruits.index(32)

print(x)

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

fruits.insert(1, “orange”)

print(fruits)

A

[‘apple’, ‘orange’, ‘banana’, ‘cherry’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

fruits.pop(1)

print(fruits)

A

[‘apple’, ‘cherry’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

x = fruits.pop(1)

print(x)

A

banana

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

fruits.remove(“banana”)

print(fruits)

A

[‘apple’, ‘cherry’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

fruits = [‘apple’, ‘banana’, ‘cherry’]

fruits.reverse()

print(fruits)

A

[‘cherry’, ‘banana’, ‘apple’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

cars = [‘Ford’, ‘BMW’, ‘Volvo’]

cars.sort()

print(cars)

A

[‘BMW’, ‘Ford’, ‘Volvo’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

cars = [‘Ford’, ‘BMW’, ‘Volvo’]

cars.sort(reverse=True)

print(cars)

A

[‘Volvo’, ‘Ford’, ‘BMW’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly