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

 

Anger over Russian convoy in Ukraine (22 Aug 2014)

 

US anger at China 'air interception' (22 Aug 2014)

 

Israel vows response to boy's death (22 Aug 2014)

 

Ebola outbreak speed 'unprecedented' (22 Aug 2014)

 

Dozens killed in Iraq mosque attack (22 Aug 2014)

 

National Guard pulls out of Ferguson (23 Aug 2014)

 

Colombia military meet Farc rebels (22 Aug 2014)

 

Woman 'saw Congo colonel order rape' (22 Aug 2014)

 

Syria death toll 'more than 191,000' (22 Aug 2014)

 

German policeman in 'cannibal' trial (22 Aug 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

"MythBusters" Drops Kari Byron, Grant Imahara, Tory Belleci (2014-08-23T01:18:00Z)

 

Google Wants To Test Driverless Cars In a Simulation (2014-08-22T23:34:00Z)

 

Illinois University Restricts Access To Social Media, Online Political Content (2014-08-22T22:53:00Z)

 

Ask Slashdot: Where Can I Find Good Replacement Batteries? (2014-08-22T22:11:00Z)

 

Finding an ISIS Training Camp Using Google Earth (2014-08-22T21:28:00Z)

 

Researchers Hack Gmail With 92 Percent Success Rate (2014-08-22T20:46:00Z)

 

A Better Way To Make Mind-Controlled Prosthetic Limbs (2014-08-22T20:04:00Z)

 

A Better Way To Make Mind-Controlled Prosthetic Limbs (2014-08-22T20:04: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)

 

Airbnb squatters leave Palm Springs condo (22 Aug 2014)

 

Toms sells 50% stake to Bain Capital to fund sales expansion (22 Aug 2014)

 

Gap profit tops estimates as Old Navy boosts sales (22 Aug 2014)

 

Online report of possible PayPal spinoff boosts eBay stock (22 Aug 2014)

 

Craig Menear will become Home Depot CEO (22 Aug 2014)

 

Atlantic City casino workers face joblessness, turn to prayer (22 Aug 2014)

more »

 

Asia Times Online

 

Why Washington's war on terror failed (Fri 22 Aug 2014 11:00:00 GMT)

 

THE ROVING EYE The killer on the (Saudi) king's highway (Fri 22 Aug 2014 11:00:00 GMT)

 

ISIS: Caliphate or pretenders? (Fri 22 Aug 2014 11:00:00 GMT)

 

Delicate diplomacy for Vietnam (Fri 22 Aug 2014 11:00:00 GMT)

 

'Paramilitarizing' the South China Sea (Fri 22 Aug 2014 11:00:00 GMT)

 

SINOGRAPH Simon Leys: An appreciation (Fri 22 Aug 2014 11:00:00 GMT)

 

Sunni Awakening in Iraq and the future of IS (Fri 22 Aug 2014 11:00:00 GMT)

 

Sanctions rebound to hit Europeans (Fri 22 Aug 2014 11:00:00 GMT)

 

Rights before weapons for Vietnam (Fri 22 Aug 2014 11:00:00 GMT)

 

The American cult of bombing (Fri 22 Aug 2014 11:00:00 GMT)

 

Laos 'halts work' on Don Sahong dam (Fri 22 Aug 2014 11:00:00 GMT)

 

China still backing Lao high-speed train (Fri 22 Aug 2014 11:00:00 GMT)

more »

 


Site feed Updated: 2014-Aug-22 19:00