http://qs321.pair.com?node_id=31571

As you can see, this is not obfuscated and the game is quite stupid. This is in fact my try to make Perlists and Pythonists friends again.

Juste note that the Perl code could be way shorter, whereas the Python one could not. :-)

###################################################################### # Python # Perl # ###################################################################### q = -1 ; #=; $n = int rand 1001; print '? '; q# import whrandom ; i = 1 #; while(<>){ q# n = whrandom.randint(0,1000) #; $i++; q# while q != n : #; last if $_ == $n; q# q = int(raw_input('? ')) #; print 'Too '; q# if q == n : #; print ($_>$n?'big':'small'); q# break #; print "\n? "; q# print 'Too', #; } q# if q > n : #; print "You won in $i tries\n"; q; print 'big' # else: # print 'small' # i = i + 1 # print 'You won in', i, 'tries' #;

You might as well imagine this as documenting Python code in Perl, and Perl code in Python, for beginners in any of the two languages.