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

 

Jordan plane 'not shot down by IS' (24 Dec 2014)

 

St Louis unrest after police killing (24 Dec 2014)

 

Christians gather in Bethlehem (25 Dec 2014)

 

Pakistan army to try terror suspects (24 Dec 2014)

 

Sony releases The Interview online (24 Dec 2014)

 

Pope Francis phones Iraqi refugees (24 Dec 2014)

 

Spain's king condemns corruption (24 Dec 2014)

 

US lab worker monitored for Ebola (25 Dec 2014)

 

Putin acts to halt rising vodka cost (24 Dec 2014)

 

French jobless total at new record (24 Dec 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

App Gives You Free Ebooks of Your Paperbacks When You Take a "Shelfie" (2014-12-25T01:35:00Z)

 

Samsung Galaxy Note Edge Review (2014-12-25T00:38:00Z)

 

Scientists Say the Future Looks Bleak For Our Bones (2014-12-24T23:50:00Z)

 

Did North Korea Really Attack Sony? (2014-12-24T23:02:00Z)

 

Google Motion Denied In Lawsuit Against Mississippi Attorney General (2014-12-24T22:15:00Z)

 

Subsurface 4.3 Released (2014-12-24T21:26:00Z)

 

UK Man Arrested Over "Offensive" Tweet (2014-12-24T20:38:00Z)

 

US Internet Offers 10Gbps Fiber In Minneapolis (2014-12-24T19:50: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)

 

Business News Roundup, Dec. 25 (24 Dec 2014)

 

Uber CEO Kalanick indicted in South Korea over taxi service (24 Dec 2014)

 

New website is like Couchsurfing for Airbnb hosts (24 Dec 2014)

 

Worldreader gives free e-books to kids around the world (24 Dec 2014)

 

How publishers did everything wrong fighting Amazon over e-books (24 Dec 2014)

 

Walmart tests gift card exchange (24 Dec 2014)

more »

 

Asia Times Online

 

THE ROVING EYE Russia, China mock divide and rule (Tue 23 Dec 2014 11:00:00 GMT)

 

COMMENT We got by with a little help ... (Tue 23 Dec 2014 11:00:00 GMT)

 

North Korean Internet back after outage (Tue 23 Dec 2014 11:00:00 GMT)

 

Turkey and the Middle East quagmire (Tue 23 Dec 2014 11:00:00 GMT)

 

2014 a game-changer in Palestine (Tue 23 Dec 2014 11:00:00 GMT)

 

Washington's gold standard on torture (Tue 23 Dec 2014 11:00:00 GMT)

 

Oil slump gives Iran a window of opportunity (Tue 23 Dec 2014 11:00:00 GMT)

 

China sinks to 'new normal' (Tue 23 Dec 2014 11:00:00 GMT)

 

THE BEAR'S LAIR Dead hand of regulation (Tue 23 Dec 2014 11:00:00 GMT)

more »

 


Site feed Updated: 2014-Dec-24 21:00