[Tutor] banners
Alan Gauld
alan.gauld at btinternet.com
Sun Aug 20 19:52:57 CEST 2006
"josip" <josipl2000 at yahoo.com> wrote
>i did it.
Well done!
> for i in range(3):
> print '*' * 5 + '\t *'
> if i in range(0,1):
range(0,1) is [0], so you could just do
if i == 0:
> print '*'+' ' *4 + '\t *'
> if i in range(1,2):
similarly range(1,2) is [1] so
if i == 1:
> print ' ' * 4 + '* * *'
> is this code ok?
Inasmuch as it works, yes its OK
It can be improved as noted above.
There are various ways of tidying it up too, but at this stage
they are probably too complex for you, we'll leave them for
later.
There is one much simpler approach too - triple quotes...
But well done for getting it to work.
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list