----- Original Message ----- 
From: "Kevin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 01, 2005 12:35 AM
Subject: [Tutor] printing out a box of O's
> there a better way to do
> this:
> 
> j = 'O'
> for i in j*10:
> print i * 100

Its not bad, but the for loop could be 'simplified' to:

for i in range(10):
  print j*100

its not any shorter and probably doesn't run much faster 
but its a lot more readable because its the conventional 
Python idiom for coding fixed length loops.

Alan G.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to