tungwaiyip.info

home

about me

links

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

 

South African church attack: Five dead after 'hostage situation' (11 Jul 2020)

 

Roger Stone: Critics blast Trump for commuting ex-adviser's jail term (11 Jul 2020)

 

Jack Charlton: 1966 England World Cup winner dies aged 85 (11 Jul 2020)

 

Russia far east protest over Khabarovsk governor's arrest (11 Jul 2020)

 

Nigeria: 11-year old dancer challenges ballet stereotypes (10 Jul 2020)

 

Jada Pinkett Smith tells Will Smith of her 'relationship' (10 Jul 2020)

 

Srebrenica: Bosnia marks 25 years since massacre (11 Jul 2020)

 

Coronavirus: Calls for government to clarify face coverings in England (11 Jul 2020)

 

Duda vs Trzaskowski: The fight for Poland's future (10 Jul 2020)

 

TikTok: Amazon says email asking staff to remove app 'sent in error' (10 Jul 2020)

more »

 

SF Gate

 

Jack Dorsey donates million to 15 cities to explore universal basic incomes, including Oakland (10 Jul 2020)

 

Ship traffic, July 13 (10 Jul 2020)

 

Ship traffic, July 12 (10 Jul 2020)

 

Ship traffic, July 11 (10 Jul 2020)

 

Ship traffic, July 10 (9 Jul 2020)

 

Ship traffic, July 9 (8 Jul 2020)

more »


Site feed Updated: 2020-Jul-11 09:00