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

19th Jun 2017, 2:47 AM
Talia Pacelli
Talia Pacelli - avatar
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.
19th Jun 2017, 3:29 AM
Venkatesh Pitta
Venkatesh Pitta - avatar
+ 1
I wrote lost. meant to say list***
19th Jun 2017, 3:30 AM
Talia Pacelli
Talia Pacelli - avatar
+ 1
not exactly sure how to use join
19th Jun 2017, 3:32 AM
Talia Pacelli
Talia Pacelli - avatar
+ 1
I was able to create that code for list. would you have any clue on how I can finish this other code?
19th Jun 2017, 3:36 AM
Talia Pacelli
Talia Pacelli - avatar