[Tutor] Newbie

Alan Gauld alan.gauld at btinternet.com
Wed Jul 23 22:04:57 CEST 2008


""Simón A. Ruiz"" <sruiz at canterburyschool.org> wrote
> If what you expected was something like:
>
> Hello World!
> Here are ten numbers from 0 to 9
> 0 1 2 3 4 5 6 7 8 9 Goodbye World!
>
> Then you want that final print statement to not be included in your 
> for loop block; i.e., unindent it:

And if you wanted the Goodbye on a separate line add a
newline character('\n') in front of the text:

for i in range(10):
     print i,
print "\nGoodbye World!"

You now have at least 3 options to pick from :-)

-- 
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