Quiz Catalog

Catalog of quizzes

a = [[] * 2] * 2
a[0].append(1)

print(a)
[[1], [1]]
  • object/reference
  • list/operation/append
  • list/operation/multiply,

lst = ["ab", "vm"]
for x in lst:
  lst.append(x.upper())

print(lst)
Infinite loop.
  • list/operation/append
  • string/operation/upper

lst = [4.6, 2.3, 7.8]
a = list([2, 5.9])

for num in lst:
  a.append(int(num))

print(a)
[2, 5.9, 4, 2, 7]
  • build-in/int
  • build-in/list
  • list/operation/append

furniture_1 = ["TV", "Projector", "Playstation"]
furniture_2 = ["Fridge", "Cooker", "Toster"]

furniture_1.extend(furniture_2)
furniture_2.append(furniture_1)

print(furniture_2)
['Fridge', 'Cooker', 'Toster', ['TV', 'Projector', 'Playstation', 'Fridge', 'Cooker', 'Toster']]
  • list/operation/extend
  • list/operation/append

mylist1 = [[],[-1]]
mylist2 = [[],[-1]]
mylist2.sort()
print(mylist1 is mylist2)
False
  • object/identify
  • list/operation/append