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

 

US election: Sanders says Clinton must be US president (26 Jul 2016)

 

Japan knife attack: 19 killed at care centre in Sagamihara (26 Jul 2016)

 

Solar Impulse completes historic round-the-world trip (26 Jul 2016)

 

Blasts heard near Mogadishu airport (26 Jul 2016)

 

Bangladesh police kill nine suspected militants in raid (26 Jul 2016)

 

Australia PM calls for investigation into juvenile 'torture' (26 Jul 2016)

 

Ship hits wall of Panama Canal renewing design concerns (26 Jul 2016)

 

Ansbach explosion: Bomber pledged allegiance to IS (25 Jul 2016)

 

South Sudan: Salva Kiir removes Riek Machar as deputy leader (25 Jul 2016)

 

Spain registers first Zika microcephaly birth in Europe (25 Jul 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)

 

Fed prepares new action against Goldman Sachs in leak case (25 Jul 2016)

 

A New Zealand jiu-jitsu fighter says he was kidnapped and robbed in Rio by people in police uniforms (25 Jul 2016)

 

Yahoo sells core business to Verizon (25 Jul 2016)

 

Yahoo, Verizon set to announce .8 billion deal (25 Jul 2016)

 

Organic Valley highlights authenticity with table-to-farm visits (23 Jul 2016)

 

Lesbians and ‘Pokémon Go’ players are fine, Nike foes aren’t (22 Jul 2016)

more »

 


Site feed Updated: 2016-Jul-26 00:00