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

 

Greek PM 'offers fresh compromise' (01 Jul 2015)

 

Egypt's Sinai hit by deadly attacks (01 Jul 2015)

 

Barrier Reef spared 'danger' listing (01 Jul 2015)

 

US and Cuba announce embassies (01 Jul 2015)

 

Syria rebels shoot dead IS militants (01 Jul 2015)

 

'British Schindler' Winton dies (01 Jul 2015)

 

Thousands attend HK democracy rally (01 Jul 2015)

 

Europe hit by soaring temperatures (01 Jul 2015)

 

Fire claims another US black church (01 Jul 2015)

 

French troops suspended over child sex (01 Jul 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

Struggling University of Phoenix Lays Off 900 (2015-07-01T13:48:00+00:00)

 

People Are Obtaining Windows 7 Licenses For the Free Windows 10 Upgrade (2015-07-01T13:05:00+00:00)

 

Amazon's New SSL/TLS Implementation In 6,000 Lines of Code (2015-07-01T12:22:00+00:00)

 

How Verizon Is Hindering NYC's Internet Service (2015-07-01T11:42:00+00:00)

 

MIT's Bitcoin-Inspired 'Enigma' Lets Computers Mine Encrypted Data (2015-07-01T09:20:00+00:00)

 

Analysis: Iran's Nuclear Program Has Been an Astronomical Waste (2015-07-01T06:13:00+00:00)

 

UK's National Computer Museum Looks For Help Repairing BBC Micros (2015-07-01T04:05:00+00:00)

 

Surveillance Court: NSA Can Resume Bulk Surveillance (2015-07-01T02:08: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)

 

Flying the friendly skies, fueled by trash (1 Jul 2015)

 

Celgene pays billion for stake in Juno cancer research (1 Jul 2015)

 

JetBlue adds fee for checked bags (1 Jul 2015)

 

Business News Roundup, July 1 (1 Jul 2015)

 

Nike co-founder Phil Knight to step down as chairman (30 Jun 2015)

 

London man starts crowdfunding campaign for Greece bailout (30 Jun 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-01 09:00