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

 

Co-pilot 'wanted to destroy plane' (27 Mar 2015)

 

Yemen leader Hadi gets Saudi refuge (27 Mar 2015)

 

Buildings collapse in New York blast (26 Mar 2015)

 

Argentine president's case dismissed (26 Mar 2015)

 

US agents 'attended sex parties' (27 Mar 2015)

 

Shia militias 'in Tikrit pullback' (26 Mar 2015)

 

Indiana emergency for HIV 'epidemic' (26 Mar 2015)

 

US soldier 'plotted to support IS' (26 Mar 2015)

 

Leaders grilled in election special (27 Mar 2015)

 

North Korea 'arrests South spies' (27 Mar 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

Win Or Lose, Discrimination Suit Is Having an Effect On Silicon Valley (2015-03-27T00:25:00+00:00)

 

GAO Denied Access To Webb Telescope Workers By Northrop Grumman (2015-03-26T23:44:00+00:00)

 

PayPal To Pay .7 Million For Sanctions Violations (2015-03-26T23:03:00+00:00)

 

Australia Passes Mandatory Data Retention Law (2015-03-26T22:20:00+00:00)

 

Micron and Intel Announce 3D NAND Flash Co-Development To Push SSDs Past 10TB (2015-03-26T21:38:00+00:00)

 

Generate Memorizable Passphrases That Even the NSA Can't Guess (2015-03-26T20:59:00+00:00)

 

'Bar Mitzvah Attack' Plagues SSL/TLS Encryption (2015-03-26T20:18:00+00:00)

 

MIT Debuts Integer Overflow Debugger (2015-03-26T19:56: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)

 

Cleaning out the digital clutter (26 Mar 2015)

 

FTC cracks down on fraud by auto dealers (26 Mar 2015)

 

Business News Roundup, March 26 (25 Mar 2015)

 

Bloomberg Briefing, March 26 (25 Mar 2015)

 

Facebook expands Messenger app, teams up with businesses (25 Mar 2015)

 

Insurers agree on framework for Uber, Lyft coverage (25 Mar 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-Mar-26 21:00