[Edu-sig] Random example, early college charter...
kirby urner
kirby.urner at gmail.com
Sat Apr 5 22:03:48 CEST 2008
"""
TECC prototype:
4D Puzzler: Egg Hunt
The following namespace has been defined:
"""
class Egg:
def __init__(self, thething):
self.__secret_prize = thething
@property
def prize(self):
return self.__secret_prize
egg = Egg("********")
struct = ( [ ( { 'a' : 1 }, { 2: 'a'} ), { ('a') : [ ] } , ] , [ {3 : egg} ] )
"""
Now reach into struct using indexing to get the
secret contents of the egg, using a one line
expression.
One possible answer:
>>> struct[1][0][3].prize
'********'
another:
>>> struct[1][0][3]._Egg__secret_prize
'********'
"""
4D:k!
More information about the Edu-sig
mailing list