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

 

Quake-hit Nepal 'on war footing' (28 Apr 2015)

 

Indonesia prisoners in final goodbye (28 Apr 2015)

 

Troops deployed for Baltimore riots (28 Apr 2015)

 

US 'monitoring' Iran ship seizure (28 Apr 2015)

 

Afghanistan landslide buries village (28 Apr 2015)

 

Saudi Arabia 'uncovers IS cells' (28 Apr 2015)

 

Sewol captain sentenced for murder (28 Apr 2015)

 

Finland on alert over suspected sub (28 Apr 2015)

 

EU's Juncker seeks 'fair deal' for UK (28 Apr 2015)

 

Burundi hit by fresh protests (28 Apr 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

US Successfully Tests Self-Steering Bullets (2015-04-28T17:22:00+00:00)

 

University Overrules Professor Who Failed Entire Management Class (2015-04-28T16:40:00+00:00)

 

Signs of Subsurface 'Alien' Life Found In Antarctica (2015-04-28T15:59:00+00:00)

 

China's Tencent Launches Smart Hardware OS To Rival Alibaba (2015-04-28T15:13:00+00:00)

 

TeslaCrypt Isn't All That Cryptic (2015-04-28T14:31:00+00:00)

 

Feds Say It's Time To Cut Back On Fluoride In Drinking Water (2015-04-28T13:33:00+00:00)

 

ATT, DirecTV Mega-Merger May Go Through (2015-04-28T12:53:00+00:00)

 

How To Increase the Number of Female Engineers (2015-04-28T12:12:00+00:00)

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, April 28 (28 Apr 2015)

 

Daily Briefing, April 28 (28 Apr 2015)

 

Apple beats estimates, expands dividends, buybacks (28 Apr 2015)

 

Assembly bill seeks ban on smart TVs becoming 'Big Brother’ (28 Apr 2015)

 

Truckers strike at L.A., Long Beach ports (27 Apr 2015)

 

After Nepal earthquake, Facebook activates safety check tool (26 Apr 2015)

more »

 

Asia Times Online

 

China ramps up charges against Zhou (Fri 20 Mar 2015 11:00:00 GMT)

 

'100 dead' in Myanmar fighting (Fri 20 Mar 2015 11:00:00 GMT)

 

Tunisian president vows no mercy (Fri 20 Mar 2015 11:00:00 GMT)

 

SPENGLER Israel's 'referendum' on 'two-state solution' (Fri 20 Mar 2015 11:00:00 GMT)

 

Russia, S Ossetia sign 'integration' pact (Fri 20 Mar 2015 11:00:00 GMT)

 

US military plunges Aquino into crisis (Fri 20 Mar 2015 11:00:00 GMT)

 

Rahmon celebrates Tajik democracy (Fri 20 Mar 2015 11:00:00 GMT)

 

THE BEAR'S LAIR Being old in 2040 no fun (Fri 20 Mar 2015 11:00:00 GMT)

 

China grant boosts Nepal ties (Fri 20 Mar 2015 11:00:00 GMT)

more »

 


Site feed Updated: 2015-Apr-28 11:00