tungwaiyip.info

home

about me

links

my software

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

 

Ukraine hit by military setbacks (01 Sep 2014)

 

Ashya parents fight extradition (01 Sep 2014)

 

'Cloud' concerns after celeb leaks (01 Sep 2014)

 

PM outlines new anti-terror plans (01 Sep 2014)

 

Iran clerics 'must accept internet' (01 Sep 2014)

 

Iraq crimes 'on unimaginable scale' (01 Sep 2014)

 

Fresh clashes in Pakistan capital (01 Sep 2014)

 

Ferguson police wear body cameras (01 Sep 2014)

 

Mexico probes mass fish death in lake (01 Sep 2014)

 

Bosnian Serbs held for 1992 killings (01 Sep 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

Power Grids: The Huge Battery Market You Never Knew Existed (2014-09-01T19:30:00Z)

 

Radioactive Wild Boars Still Roaming the Forests of Germany (2014-09-01T18:36:00Z)

 

New Nigerian ID Card Includes Prepay MasterCard Wallet (2014-09-01T17:47:00Z)

 

Reported iCloud Hack Leaks Hundreds of Private Celebrity Photos (2014-09-01T16:55:00Z)

 

Study: Antarctic Sea-Level Rising Faster Than Global Rate (2014-09-01T16:00:00Z)

 

Deputy Who Fatally Struck Cyclist While Answering Email Will Face No Charges (2014-09-01T15:10:00Z)

 

China Gives Microsoft 20 Days To Respond To Competition Probe (2014-09-01T14:12:00Z)

 

Saturn's F Ring Is Now Three Times As Wide As During the Voyager Flybys (2014-09-01T13:13:00Z)

more »

 

TechPsychic Tech Rumors and Invented News

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)

 

Ship traffic for Sept. 1 (31 Aug 2014)

 

Bay Area insider trades, Sept. 1 (31 Aug 2014)

 

Will Harvard Business School have a class with 50% women? (31 Aug 2014)

 

Mergers and acquisitions, Sept. 1 (31 Aug 2014)

 

Evernote expands its line of high-end office accessories (31 Aug 2014)

 

Product Hunt (31 Aug 2014)

more »

 

Asia Times Online

 

Gaza: Now the guns have been silenced (Fri 29 Aug 2014 11:00:00 GMT)

 

VIOLENCE IN KASHMIR Modi's muscle strains Indo-Pak talks (Fri 29 Aug 2014 11:00:00 GMT)

 

India opens door to superbugs (Fri 29 Aug 2014 11:00:00 GMT)

 

Russia welcomes Asia food imports (Fri 29 Aug 2014 11:00:00 GMT)

 

Keynes is dead; long live Marx (Fri 29 Aug 2014 11:00:00 GMT)

 

Reloading the debt dice (Fri 29 Aug 2014 11:00:00 GMT)

more »

 


Site feed Updated: 2014-Sep-01 13:00