← All quizzes

💻 Computer Science & IT

Python fundamentals

Mutability, comprehensions, the GIL and the default-argument trap that bites everyone once.

8questions

easydifficulty

+16max XP (1st try)

not rated yet

Question 1 of 8

What does `def f(items=[])` do wrong?

Question 2 of 8

Which of these is immutable?

Question 3 of 8

The GIL means that in CPython:

Question 4 of 8

`a = [1,2,3]; b = a; b.append(4)` leaves `a` as:

Question 5 of 8

A list comprehension `[x*2 for x in xs if x > 0]`:

Question 6 of 8

`with open(path) as f:` guarantees that:

Question 7 of 8

`is` compares:

Question 8 of 8

An f-string `f"{x:.2f}"` formats x as:

0/8 answered

Part of