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

 

Gunmen take hostages in Bangladeshi capital Dhaka (01 Jul 2016)

 

Brexit: Tensions emerge over UK-EU trade negotiations (01 Jul 2016)

 

Battle of the Somme: Royals at Somme centenary commemoration (01 Jul 2016)

 

US air and drone strikes 'killed up to 116 civilians' (01 Jul 2016)

 

Austria presidential poll result overturned (01 Jul 2016)

 

Willie Kimani: Missing Kenyan lawyer found dead (01 Jul 2016)

 

Syria: Rebels say pilot killed after plane shot down (01 Jul 2016)

 

Israel and Palestinians: Powers warn of 'perpetual conflict' (01 Jul 2016)

 

Cologne mayor stabbing: Man jailed and convicted (01 Jul 2016)

 

Sierra Leonean diplomat kidnapped in Kaduna, Nigeria (01 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)

 

California attorney general subpoenas refiners on gas prices (1 Jul 2016)

 

ICYMI: Cormac McCarthy and Luke Skywalker, both undead (1 Jul 2016)

 

Daily Briefing, July 2 (1 Jul 2016)

 

Samsung Gear users will get virtual reality Olympics from NBC (1 Jul 2016)

 

Kleiner Perkins raises .4 billion in 2 funds (1 Jul 2016)

 

Netflix co-founder wants to sell you a subscription to go to the movies (1 Jul 2016)

more »

 


Site feed Updated: 2016-Jul-01 15:00