Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
566 lines (451 sloc) 18.4 KB
================================================================================
QUESTION [a]:
================================================================================
Q: Who is the creator of Python, how old are they, and where do they work?
================================================================================
GUESSES:
================================================================================
Guido Van Rossum
32,38,42,45,49,54,n
Google
================================================================================
ANSWER:
================================================================================
A: Guido van Rossum is the creator of Python.
age: 55 (born Jan 31, 1956)
Guido works for Google, where he has worked since December, 2005.
http://en.wikipedia.org/wiki/Guido_van_Rossum
http://goo.gl/OrT7K
================================================================================
QUESTION [b]:
================================================================================
What does the code below the hash marks do?
################################################################################
def A(x):
x()
def B():
print("B")
A(B)
================================================================================
GUESSES:
================================================================================
B
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
B
================================================================================
QUESTION [c]:
================================================================================
Q: Who said this:
"Python's syntax succeeds in combining the mistakes of Lisp and Fortran.
I do not construe that as progress."
================================================================================
GUESSES:
================================================================================
PHP dude
Gosling
Djkstra
Rails creator
Larry Wall
Rupert Murdoch
================================================================================
ANSWER:
================================================================================
A: Larry Wall (creator of the Perl programming language), May 12, 2004
http://quotations.amk.ca/python-quotes/
http://goo.gl/Yg9W3
================================================================================
QUESTION [d]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
def x():
print("Portland")
def x():
print("Paris")
x()
================================================================================
GUESSES:
================================================================================
Paris
Portland
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
Paris
================================================================================
QUESTION [e]:
================================================================================
Q: Fill in the blank for the following quote:
"The joy of coding Python should be in seeing short, concise, readable _____ that express
a lot of action in a small amount of clear code -- not in reams of trivial code that bores
the reader to death."
-Guido van Rossum (Python creator), 20 Mar 2002
================================================================================
GUESSES:
================================================================================
code
mad libs
modules
statements
sentences
words
sequences
tokens
instructions
algorithms
functions
================================================================================
ANSWER:
================================================================================
A: classes
"The joy of coding Python should be in seeing short, concise, readable classes that express
a lot of action in a small amount of clear code -- not in reams of trivial code that bores
the reader to death."
-Guido van Rossum (Python creator), 20 Mar 2002
http://quotations.amk.ca/python-quotes/10.html
http://goo.gl/Zl4rC
================================================================================
QUESTION [f]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
larry = { 2 : 4 }
moe = { 1 : 3 }
larry.update(moe)
print(larry)
================================================================================
GUESSES:
================================================================================
depends on system
{1:3, 2:4}
{2:4, 1:3}
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
{1: 3, 2: 4}
================================================================================
QUESTION [g]:
================================================================================
Q: Which standard library has an ordered dictionary?
================================================================================
GUESSES:
================================================================================
2.7 and higher
collections
================================================================================
ANSWER:
================================================================================
A: collections
e.g.,
from collections import OrderedDict
myDict = OrderedDict( [ ("first", 1),
("second", 2),
("third", 3),
])
print myDict
================================================================================
QUESTION [h]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
a = ["one"]
a += ["two"]
print(a)
b = ["larry"]
b += "moe"
print(b)
c = [1]
c += 2
print(c)
================================================================================
GUESSES:
================================================================================
["one", "two"]
["larry", "m", "o", "e"]
type error
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
['one', 'two']
['larry', 'm', 'o', 'e']
Traceback (most recent call last):
File "h.py", line 16, in <module>
c += 2
TypeError: 'int' object is not iterable
================================================================================
QUESTION [i]:
================================================================================
Q: When was the Portland Python group formed?
================================================================================
GUESSES:
================================================================================
May, 2007
================================================================================
ANSWER:
================================================================================
A: May 8, 2007
http://wiki.python.org/moin/PortlandPythonUserGroup
http://goo.gl/OrJky
================================================================================
QUESTION [j]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
import urllib
import re
x = urllib.urlopen('http://python.org/download').read()
y,z = re.search(string=x,
pattern='(?s)The current production versions are.*?'
'Python (2\.\d+\.\d+).*?and.*?Python (3\.\d+\.\d+)').groups()
print("y: [%s]\nz: [%s]" % (y,z))
================================================================================
GUESSES:
================================================================================
inscrutable exception
2.7.2 3.2.1
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
y: [2.7.2]
z: [3.2.2]
================================================================================
QUESTION [k]:
================================================================================
Q: When did Guido van Rossum first post to Usenet about Python?
Q: What usenet group did he post it to?
Q: What was the version of this first public Python release?
================================================================================
GUESSES:
================================================================================
1989
1992
1988
comp.lang.python
alt.binaries
comp.lang.perl
0.1
0.5
0.92
.001
================================================================================
ANSWER:
================================================================================
A: Feb 20, 1991
A: alt.sources
A: 0.9.0
Python 2.7.2 docs, faq/general
http://en.wikipedia.org/wiki/History_of_Python
http://goo.gl/8qOxD
http://svn.python.org/projects/python/trunk/Misc/HISTORY
http://goo.gl/900Ns
http://groups.google.com/group/alt.sources/search?q=guido+van+rossum&start=90&sa=N&scoring=d&
http://goo.gl/C3T90
================================================================================
QUESTION [l]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
my_list = [3,1,2]
print(my_list)
print(my_list.sort())
print(my_list)
print(sorted(my_list))
print(my_list)
================================================================================
GUESSES:
================================================================================
blank line
error
None
[1,2,3]
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
[3, 1, 2]
None
[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
================================================================================
QUESTION [m]:
================================================================================
Q: When was the comp.lang.python newsgroup formed?
================================================================================
GUESSES:
================================================================================
1983
1995
1994
1997
1992
1996
================================================================================
ANSWER:
================================================================================
A: Mar 28, 1994
http://en.wikipedia.org/wiki/History_of_Python
http://goo.gl/8qOxD
http://groups.google.com/group/comp.lang.python/browse_frm/month/1994-3?scoring=d&#
http://goo.gl/0Bue7
================================================================================
QUESTION [n]:
================================================================================
Q: As of 12:40pm today (Tue, Oct 11, 2011), how many topics are there in
comp.lang.python? (according to Google Groups)
================================================================================
GUESSES:
================================================================================
37,000
37,001
1,000,000
100,000
1
================================================================================
ANSWER:
================================================================================
A: 124,563
http://groups.google.com/group/comp.lang.python/topics
http://goo.gl/iQFI
================================================================================
QUESTION [o]:
================================================================================
Q: What is the latest version of Python 2.x and when was it released?
================================================================================
GUESSES:
================================================================================
2.7.2
June 7, 2011
================================================================================
ANSWER:
================================================================================
A: version 2.7.2, released June 11, 2011
(version 2.7 was released July 3, 2010)
(version 2.0 was released Oct 16, 2000)
(version 1.6 was released Sep 5, 2000)
(version 1.0 was released Jan , 1994)
http://en.wikipedia.org/wiki/History_of_Python#Version_release_dates
http://goo.gl/65MuY
http://www.python.org/download/releases/2.7.2/
http://goo.gl/nohtW
================================================================================
QUESTION [p]:
================================================================================
Q: How many reserved words (keywords) are there in Python?
================================================================================
GUESSES:
================================================================================
32
42
52
37
================================================================================
ANSWER:
================================================================================
A: 31
and del from not while
as elif global or with
assert else if pass yield
break except import print
class exec in raise
continue finally is return
def for lambda try
http://docs.python.org/reference/lexical_analysis.html
http://goo.gl/c5T7o
================================================================================
QUESTION [q]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
print(type(2/3))
print(2/3)
================================================================================
GUESSES:
================================================================================
int
0
.6666
1
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
<type 'int'>
0
================================================================================
QUESTION [r]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
myList = ['a', 'b', 'c']
for x,y in enumerate(myList):
print(x,y)
================================================================================
GUESSES:
================================================================================
0 a
1 b
2 c
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
(0, 'a')
(1, 'b')
(2, 'c')
================================================================================
QUESTION [s]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
x = 5
assert x == 5
assert x == 6
================================================================================
GUESSES:
================================================================================
true
exception
assertion error
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
Traceback (most recent call last):
File "s.py", line 9, in <module>
assert x == 6
AssertionError
================================================================================
QUESTION [t]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
def x():
print("function x")
x = ('a','b','c')
x = ['one','two','three']
x = {1:2, 3:4}
x = "foo"
print(x)
================================================================================
GUESSES:
================================================================================
foo
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
foo
================================================================================
QUESTION [u]:
================================================================================
Q: What does the code below the hash marks do?
################################################################################
my_list = [1,2,3,4,5]
print(my_list[-3:])
================================================================================
GUESSES:
================================================================================
3
[3,4,5]
================================================================================
ANSWER / OUTPUT: [Python version: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]]
================================================================================
[3, 4, 5]