Q 01/05

Which keyword chains a second test onto an `if` statement in Python?

A) `elif`

B) `elsif`

C) `elseif`

D) `else if`

Answer · why

A) `elif`

`elif` is short for 'else if', and a ladder of elif branches was Python's stand-in for the switch statement of other languages until `match` arrived i...

Q 02/05

Which keyword ends a function call and hands a value back to the caller?

A) `return`

B) `pass`

C) `break`

D) `exit`

Answer · why

A) `return`

`return` ends the function and passes its value to the caller; a function that falls off the end without one returns None, and `exit` is not a keyword...

Q 03/05

Van Rossum began Python as a hobby project to fill which holiday break in 1989?

A) Christmas

B) Easter

C) Whitsun

D) Midsummer

Answer · why

A) Christmas

Christmas: with his office closed for the week, van Rossum wanted a 'hobby' project to keep him occupied, and he posted the first public code just ove...

Q 04/05

Which Python Enhancement Proposal is the language's official style guide?

A) PEP 1

B) PEP 8

C) PEP 257

D) PEP 3000

Answer · why

B) PEP 8

PEP 8 rests on van Rossum's insight that code is read much more often than it is written, so it fixes details such as a 79-character line limit and sn...

Q 05/05

How does Python define code blocks, unlike languages that use curly braces?

A) Indentation

B) Parentheses

C) Semicolons

D) Keywords

Answer · why

A) Indentation

Indentation marks out the blocks, and the interpreter is strict about it: Python 3 refuses to run a file whose tabs and spaces are mixed inconsistentl...

Want the full quiz?

Play the full Python Programming quiz — scored, streaked, and passable to a friend.

Play it on BrainPickle