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

 

Gaza market air strike 'kills 15' (30 Jul 2014)

 

Ukraine claims key town near Donetsk (30 Jul 2014)

 

Somali 'killed for not wearing veil' (30 Jul 2014)

 

Six dead in Nigeria college blast (30 Jul 2014)

 

Dozens trapped by Indian landslide (30 Jul 2014)

 

US economic growth surges by 4% (30 Jul 2014)

 

France evacuates expats from Libya (30 Jul 2014)

 

Ebola virus threatens UK - Hammond (30 Jul 2014)

 

House to vote to sue President Obama (30 Jul 2014)

 

Tight security after Xinjiang unrest (30 Jul 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

UK To Allow Driverless Cars By January (2014-07-30T16:29:00Z)

 

Black Hat Researchers Actively Trying To Deanonymize Tor Users (2014-07-30T15:47:00Z)

 

Ask Slashdot: Is Running Mission-Critical Servers Without a Firewall Common? (2014-07-30T15:05:00Z)

 

The Milky Way Is Much Less Massive Than Previous Thought (2014-07-30T14:43:00Z)

 

An Accidental Wikipedia Hoax (2014-07-30T14:22:00Z)

 

Nuclear Missile Command Drops Grades From Tests To Discourage Cheating (2014-07-30T13:40:00Z)

 

Ford, GM Sued Over Vehicles' Ability To Rip CD Music To Hard Drive (2014-07-30T12:57:00Z)

 

Comcast Confessions (2014-07-30T12:15: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)

 

Jerry Brown quietly taking care of business in Mexico (29 Jul 2014)

 

U.S. homeownership falls to 64.7% (29 Jul 2014)

 

,000-per-pill Sovaldi now hepatitis treatment of choice (29 Jul 2014)

 

Android 'Fake ID' flaw could let hackers hijack device (29 Jul 2014)

 

Snapdeal founder keeps close eye on Alibaba IPO (29 Jul 2014)

 

Twitter's stock soars as user growth climbs (29 Jul 2014)

more »

 

Asia Times Online

 

THE ROVING EYE Crime (Israel) and punishment (Russia) (Wed 30 Jul 2014 11:00:00 GMT)

 

Vietnam buckles under Chinese pressure (Wed 30 Jul 2014 11:00:00 GMT)

 

Dozens of Uyghurs killed in Xinjiang clashes (Wed 30 Jul 2014 11:00:00 GMT)

 

http://www.atimes.com/atimes/Middle_East/MID-01-300714.html (Wed 30 Jul 2014 11:00:00 GMT)

 

CHAN AKYA An era of thugs (Wed 30 Jul 2014 11:00:00 GMT)

 

The Pashtun factor in Pakistan's insurgency (Wed 30 Jul 2014 11:00:00 GMT)

 

BOOK REVIEW Pakistan's proclivity for war (Wed 30 Jul 2014 11:00:00 GMT)

 

JOHN PILGER Palestine, war and lethal reporting (Wed 30 Jul 2014 11:00:00 GMT)

 

Russia told to pay in Yukos case (Wed 30 Jul 2014 11:00:00 GMT)

 

Central Asia clash mars China gas plan (Wed 30 Jul 2014 11:00:00 GMT)

 

THE BEAR'S LAIR Business and free markets (Wed 30 Jul 2014 11:00:00 GMT)

more »

 


Site feed Updated: 2014-Jul-30 10:00