How to print a line feed after this loop

This is the place for queries that don't fit in any of the other categories.

How to print a line feed after this loop

Postby jdubya » Fri Apr 18, 2014 3:05 pm

This loop prints a list of numbers and leaves the prompt on the same line. How can I insert a linefeed to get the prompt on the next line?
Code: Select all
   #print list after sorting
   for j in range(0,len(nums)):
      print(nums[j], end=" ")
            
main()
jdubya
 
Posts: 4
Joined: Wed Apr 16, 2014 5:10 am

Re: How to print a line feed after this loop

Postby stranac » Fri Apr 18, 2014 3:22 pm

Code: Select all
print()
after the loop?

Also,
Code: Select all
for i in xrange(somelist):
    somelist[i]

should always be:
Code: Select all
for item in somelist:
    item
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: How to print a line feed after this loop

Postby jdubya » Fri Apr 18, 2014 3:28 pm

Got it. Thanks!
Last edited by stranac on Fri Apr 18, 2014 3:40 pm, edited 1 time in total.
Reason: No need to quote the entire previous post.
jdubya
 
Posts: 4
Joined: Wed Apr 16, 2014 5:10 am


Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 3 guests