+ 3

Help with a code

How do you turn this... x="A 16,B 17,C 18" into this?... z=[["A","16"],["B","17"],["C","18"]] This attached code is my try. It'll explain a bit more. https://code.sololearn.com/czruZCa4PX53/?ref=app

9th Nov 2018, 7:43 PM
Sir White Cat
Sir White Cat - avatar
2 Respostas
+ 5
https://code.sololearn.com/cg4zP3pNU7ve/?ref=app Now?
9th Nov 2018, 7:51 PM
Roneel
Roneel - avatar
+ 3
List comprehension is also possible: y = [u.split(" ") for u in x.split(",")]
10th Nov 2018, 3:55 AM
Leif
Leif - avatar