Help With Python
Matt
matthew_shomphe at countrywide.com
Wed Jan 26 16:31:30 EST 2005
Nick Vargish wrote:
> Here's my Monty Pythonic answer:
>
> ## cut here
> class Viking():
>
> def __init__():
> pass
>
> def order():
> return 'Spam'
>
> # this is one viking making one order repeated 511 times. if you want
> # 511 vikings making seperate orders, you'll have to write a loop.
> v = Viking()
> orders = [ v.order() ] * 511
>
> print ', '.join(orders)
> ## cut here
>
> With no apologies to Eric Idle,
>
> Nick
>
>
> --
> # sigmask || 0.2 || 20030107 || public domain || feed this
to a python
> print reduce(lambda x,y:x+chr(ord(y)-1),'
Ojdl!Wbshjti!=obwAcboefstobudi/psh?')
Not to be nit-picky, but you got some issues here ;-). Never forget
the importance of "self"!
#######################
class Viking:
. def __init__(self):
. pass
. def sing(self):
. return 'Spam'
v = Viking()
spam_song = [ v.sing() ] * 511
print ', '.join(spam_song)
More information about the Python-list
mailing list