+ 1
Making a list in python?
I want to create a program that prints a lost with all the items separated by a comma and a space with and inserted before the last item. but the program needs to work with any lost. I'm thinking I need to use a loop?
4 RĂ©ponses
+ 1
allow me to introduce you to join. here is one way to use it.
','.join(str(x) for x in range(1,100))
go on. try it on your PC or the playground here.
in cases where the list is made of objects, the classes need to implement their own __str()__ if they desire.
+ 1
I wrote lost. meant to say list***
+ 1
not exactly sure how to use join
+ 1
I was able to create that code for list. would you have any clue on how I can finish this other code?