- publishing free software manuals

Articles > Python Quiz

Test your knowledge of Python with this quiz!

All answers can be found in the book "An Introduction to Python" (ISBN 978-1-906966-13-3) by Guido van Rossum and Fred L. Drake, Jr., in electronic or paperback format.

  1. In Python 3/2 is (a) 1.5 (b) 1 ? (p 12)
  2. How do you make a string containing Unicode characters? (p 19)
  3. If a general tuple can created with tuple = a, b, c, ..., z how do you make a tuple of length 1? (p 43)
  4. Consider x, y = 1, 2; x, y = y, x; print x, y. Is the result 2 1 or 2 2 ? Think carefully. (p 43)
  5. Is "Practical Extraction and Report Language" > "Python" True or False? (p 47)
  6. Which of the following are mutable: string, list, tuple, dictionary key ? (p 16, p 21, p 43, p 44)
  7. How can you safely compute z = y / x when x might be zero? (p 71)
  8. What keyword is used to free resources reliably in the event of a failure? (p 73)
  9. What is the difference between x.f and x.f()? (p 81)
  10. What is the scope of default values in argument lists and does it matter? (Very Difficult, p 31)

The page number of the answer is given in parentheses.