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

 

EU 'to back' visa-free travel for Turks (03 May 2016)

 

Death sparks probe into China's Baidu (03 May 2016)

 

Leicester win Premier League title (02 May 2016)

 

HSBC first-quarter profit falls 14% (03 May 2016)

 

South Korea Olympic chair resigns (03 May 2016)

 

Child rescued in Kenya building collapse (03 May 2016)

 

Has Cook's Australia ship been found? (03 May 2016)

 

Solar Impulse reaches Arizona (03 May 2016)

 

Celebrities go metallic at Met Gala (03 May 2016)

 

Brazil to investigate opposition leader (03 May 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)

 

Facebook’s WhatsApp blocked in Brazil, again (2 May 2016)

 

Daily Briefing, May 3 (2 May 2016)

 

Oculus Rift delays flatten virtual-reality fan fervor (30 Apr 2016)

 

Tech gifts for Mom for or less (30 Apr 2016)

 

Self-driving cars: What should the inside look like? (30 Apr 2016)

 

Feds investigating payment service Venmo over practices (30 Apr 2016)

more »

 


Site feed Updated: 2016-May-03 00:00