[Tutor] printing out a box of O's

Rainer Mansfeld MLists at romulo.de
Tue Mar 1 15:15:08 CET 2005


Kevin schrieb:
> I just started getting in to python and for taking a look at the for
> loop. I want to print out a box
> of O's 10o chars long by 10 lines long this is what I came up with. Is
> there a better way to do
> this:
> 
> j = 'O'
> for i in j*10:
> 	print i * 100
> 
> Thanks
> 
> Kevin

Hi Kevin,

I don't know, if this is better, but at least it's shorter:

 >>> print ('O' * 100 + '\n') * 10

   Rainer


More information about the Tutor mailing list