List sorting | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

List sorting

i want to take list input from the user in a single line and then want to do its bubble sorting. i dont want to take the size of the list and the user can input as many elements as he wants without mentioning the size of the list.

28th Oct 2017, 5:24 PM
sarthak tyagi
sarthak tyagi - avatar
1 Answer
+ 1
if he/she seperates the elements with "," or spaces or somthing you can just do input().split(",") and you got a list with elements
28th Oct 2017, 5:32 PM
Chrizzhigh
Chrizzhigh - avatar