Click here if you haven't taken the quiz.
The quiz questions are repeated below along with their answers. At the very bottom there's a quick answer key if you just want to grade yourself quickly.
Count the number of questions out of 10 that you had the correct answer for.
- 10/10: Congratulations! You are an expert at Python edge cases!
- 9/10: Great job! You are proficient at Python edge cases!
- 8/10: Not bad! You are skilled at Python edge cases!
- 7/10 or less: This quiz is unable to distinguish your results from random chance with any statistical certainty. Sorry.
Just remember that edge cases can be interesting, but knowing the exact behavior of Python edge cases is not the same as being a good Python programmer. If you follow good programming practices, you can avoid problems caused by edge cases, even ones you're not aware of.
I hope this was fun, though. Thanks for trying it out!
No. This snippet is impossible.
>>> x, a, b, c = ???
>>> max(x) < max(x[a:b:c])
True
Yes. This snippet is possible.
>>> x, y = {0}, {1}
>>> min(x, y) == min(y, x)
False
No. This snippet is impossible.
>>> x, y = ???
>>> any(x) and not any(x + y)
True
Yes. This snippet is possible.
>>> x, y = "a", ""
>>> x.count(y) <= len(x)
False
Yes. This snippet is possible.
>>> x, y, z = [0], -1, -1
>>> x * (y * z) == (x * y) * z
False
Yes. This snippet is possible.
>>> x, y = [], [0]
>>> x < y and all(a >= b for a, b in zip(x, y))
True
No. This snippet is impossible.
>>> x = ???
>>> len(set(list(x))) == len(list(set(x)))
False
Yes. This snippet is possible.
>>> x = [[0]]
>>> min(x) == min(*x)
False
No. This snippet is impossible.
>>> x, y = ???
>>> sum(0 * x, y) == y
False
Yes. This snippet is possible.
>>> x, y = "aa", "aa"
>>> y > max(x) and y in x
True
- No
- Yes
- No
- Yes
- Yes
- Yes
- No
- Yes
- No
- Yes