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

 

Apple should repay Ireland 13bn euros, European Commission rules (30 Aug 2016)

 

Chinese embassy blast: Car bomb attack in Bishkek, Kyrgyzstan (30 Aug 2016)

 

Topless Marianne remark by PM Manuel Valls stirs French row (30 Aug 2016)

 

Thousands of migrants rescued off Libya (30 Aug 2016)

 

Kim Dotcom wins right to livestream extradition appeal (30 Aug 2016)

 

Australia hostel knife attack: Thomas Jackson dies (30 Aug 2016)

 

Mel Brooks leads tributes to Gene Wilder (30 Aug 2016)

 

Nepal bans Indian police pair for 'fake' Everest climb (30 Aug 2016)

 

California closes legal loophole after Stanford assault (30 Aug 2016)

 

Somalia truck bomb targets Mogadishu's SYL Hotel (30 Aug 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)

 

Fitbit makes exercise even more of a game (29 Aug 2016)

 

40 years on, the Internet transmits every aspect of our lives (27 Aug 2016)

 

Back-to-school portable computers (27 Aug 2016)

 

Frank Ocean’s ‘Blonde’ amplifies discord in the music business (27 Aug 2016)

 

For LGBT entrepreneurs, identity becomes an asset (27 Aug 2016)

 

ICYMI: Woz’s iPhone worries; Starbucks lives; tweeting ‘Hamilton’ (26 Aug 2016)

more »

 


Site feed Updated: 2016-Aug-30 06:00