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

 

Plane debris flown out of Reunion (31 Jul 2015)

 

Extra fencing and dogs for Calais (31 Jul 2015)

 

India and Bangladesh swap enclaves (31 Jul 2015)

 

Afghan militant leader 'has died' (31 Jul 2015)

 

Baghdad sees heatwave protests (31 Jul 2015)

 

Ebola vaccine results 'remarkable' (31 Jul 2015)

 

Syria group 'seizes US-backed rebels' (31 Jul 2015)

 

Putin 'ordered Litvinenko killing' (31 Jul 2015)

 

Hollande denies deal with Russia (31 Jul 2015)

 

Israel vows to find W Bank arsonists (31 Jul 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

GasBuddy Has a New Privacy Policy (Spoiler: Not As Customer Friendly) (2015-08-01T00:54:00+00:00)

 

Questioning the Dispute Over Key Escrow (2015-07-31T23:38:00+00:00)

 

Tor Project Pilots Exit Nodes In Libraries (2015-07-31T22:56:00+00:00)

 

Critical BIND Denial-of-Service Flaw Could Take Down DNS Servers (2015-07-31T22:14:00+00:00)

 

Urthecast Brings You Earth Images and Videos from the ISS (Video) (2015-07-31T21:31:00+00:00)

 

China's Island-Building In Pictures (2015-07-31T20:45:00+00:00)

 

Will Autonomous Cars Be the Insurance Industry's Napster Moment? (2015-07-31T20:03:00+00:00)

 

Munich Planning Highway System For Cyclists (2015-07-31T19:20: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)

 

Facebook unveils Web-connected aircraft with wingspan of a 737 (31 Jul 2015)

 

Steep discounts a boon for customers, but a gamble for startups (30 Jul 2015)

 

Business News Roundup, July 31 (30 Jul 2015)

 

Daily Briefing, July 31 (30 Jul 2015)

 

LinkedIn beats estimates, but stock gets beat up (30 Jul 2015)

 

Income inequality in Bay Area exceeds national levels (30 Jul 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-Jul-31 18:00