tungwaiyip.info

home

about me

links

Blog

< November 2011 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

A Program That Output Itself

Long time ago my schoolmate pose a challenge, write a program those output is itself. I take on the challenge think I'm fairly good in programming and mathematics. But I can never get it right and this problem haunted me for many years.

def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

rep("""def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

""")

Now that I'm reading Gödel, Escher, Bach I finally beginning to learn the technique. I am really happy to finally successfully written the program that output itself in Python above!

2011.11.17 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

Belarus election: Opposition leader Tikhanovskaya made 'difficult decision to leave' (11 Aug 2020)

 

Trump escorted out of briefing as man shot near White House (11 Aug 2020)

 

UK employment falls by biggest amount in over a decade (11 Aug 2020)

 

Beirut explosion: 'Who could replace her?' (11 Aug 2020)

 

Stunning 'reverse waterfall' filmed near Sydney (11 Aug 2020)

 

Beirut explosion: Lebanon's government resigns as public anger mounts (10 Aug 2020)

 

Hong Kong paper Apple Daily defiant after arrest (11 Aug 2020)

 

Downfall: BP worker sacked after Hitler meme wins payout (10 Aug 2020)

 

Berlin murder: Slovakia to expel three Russian diplomats (10 Aug 2020)

 

Apple boss Tim Cook joins the billionaires club (11 Aug 2020)

more »

 

SF Gate

 

Ship traffic, August 11 (10 Aug 2020)

 

Ship traffic, August 10 (7 Aug 2020)

 

Ship traffic, August 9 (7 Aug 2020)

 

Ship traffic, August 8 (7 Aug 2020)

 

Ship traffic, August 7 (6 Aug 2020)

 

Ship traffic, August 6 (5 Aug 2020)

more »


Site feed Updated: 2020-Aug-11 03:00