Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 565 lines (451 sloc) 18.853 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565
================================================================================
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]
Something went wrong with that request. Please try again.