tungwaiyip.info

home

about me

links

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

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

 

The rest secret (26 Sep 2016)

 

Colombia peace deal: Historic agreement is signed (27 Sep 2016)

 

Europa moon 'spewing water jets' (26 Sep 2016)

 

Sam Allardyce: England manager allegations investigated by FA (27 Sep 2016)

 

Syria conflict: Obama 'deeply concerned' about Aleppo (26 Sep 2016)

 

Washington state mall shooting: Suspect 'admits' gun attack (27 Sep 2016)

 

US slaps sanctions on Chinese firm over North Korea ties (27 Sep 2016)

 

Spain Bankia fraud trial for ex-IMF boss Rodrigo Rato (26 Sep 2016)

 

Houston gunman who injured nine in mall attack was 'disgruntled lawyer' (27 Sep 2016)

 

Saudi women file petition to end male guardianship system (26 Sep 2016)

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

Disney eyes Twitter; investors pressure North Carolina over LGBT (26 Sep 2016)

 

Cell phones, not banks, may be key to finance in developing world (26 Sep 2016)

 

Best wireless Bluetooth headphones (25 Sep 2016)

 

Oracle cuts pay of top executives (25 Sep 2016)

 

Twitter stock soars with talk of Google, Salesforce bids (24 Sep 2016)

 

‘Mr. Robot’ gives hackers a show to call their own (24 Sep 2016)

more »

 


Site feed Updated: 2016-Sep-26 21:00