Can I split a string and treat each value as an value in a list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can I split a string and treat each value as an value in a list?

So if you look in the program, it will make more sense. Basically, the user enters a series of numbers such as: 1,3,2,5,7,4 and put into a list to be sorted and displayed. The problem is it's treating the number series as one value. https://code.sololearn.com/czejVaP1dxab/?ref=app

17th Oct 2017, 10:31 AM
Keegan Robertson
Keegan Robertson - avatar
1 Answer
+ 2
You can actually treat x as a list and split the given string during input. that saves you a lot of trouble. Hope it's helpful :) https://code.sololearn.com/cmz3wEpVXrfo/?ref=app
17th Oct 2017, 11:31 AM
Αντώνης Βήχος
Αντώνης Βήχος - avatar