Import Python Quiz


Quiz Prize


Writing Idiomatic Python

By Jeff Knupp

The Complete Bundle Covering Both Python 2.x and 3.x.

Quiz Rules


  • One submission is eligible per person. Please don't use multiple email address.
  • We trust you to be fair and not google to answer the question.
  • Five random() individuals who answer all questions correctly will be the winners.
  • The Quiz will be closed/over on 30th Nov 11.59 PM IST. Correct Answers and Winners will be announced on 1st Dec in ImportPython Newsletter and Blog.
  • Quiz is valid for Python 2.7.12 onwards.

Import Python Quiz - #1


1. Which of the following import will cause an ImportError ?

import zen

import antigravity

import this


2. Which of the below statement is Idiomatic ?

if "data": do_something()

if "data":
    do_something()

3. What's will be the value of the variable "result" in the below program.

array = [1,2,3]
result = array[10:]




4. What numbers are printed by the below program.

Ignore "(" and "," in the output Python 2.x users.

class Node(object):
    ctr = 1
class SubNodeA(Node):
    pass
class SubNodeB(Node):
    pass
print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr)
Node.ctr = 3
print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr)
SubNodeB.ctr = 2
print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr)
SubNodeA.ctr = 4
print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr)


1 1 1
3 3 3
3 3 2
3 4 2



1 1 1
3 3 3
2 2 2
4 4 4



1 1 1
3 1 1
3 2 2
3 2 4



1 1 1
3 3 3
2 2 2
4 4 4



5. What's the default byte-code interpreter of Python ?.






Warning! Please attempt all questions and enter valid email address.
This email will be used only to inform if you have won the quiz.