Feb-15-2020, 01:45 AM
Using python 3 I am trying the following code. I would like to change the last two lines of the code where the print(*uninvlist, sep=", " is in the directly above that lines print statement. That way its all in one line. How would I code that where the sep wouldn't error it out. It works fine as a separate line. Im just doing some learning exercises in a book and would like to go a little further with it.
uninvlist = [] #created a empty list that I can add too
uninvlist.insert (0, uninvited_guest.title()) #inserting the first one
uninvlist.insert (-1, seconduniv.title())
uninvlist.insert (-1, thirduniv.title())
uninvlist.insert (-1, forthuniv.title())
uninvlist.sort() #sorts the list
#uninvlist = (uninvited_guest) + (firstuniv) + (seconduniv) + (thirduniv) + (forthuniv) #runs it as one word
#messulist = uninvlist #adding the list to a message
print('\nThe entire uninvited list for the party is as follows:')# + (univmessage))
print(*uninvlist, sep=", ") # removed the [] had to put on a separate line for now
