Hello, I'm a beginner in programming. I want to divide the elements in the list into random sizes, what should I do?
a = [ 1, 2, 3, 4, 5, 6, 7, 8]
#At the time of output
a = [[1,2],[3,4,5],[6,7],[8]]
a = [[1,2,3],[4,5],[6,7,8]]
a = [[2,5,4],[1,3],[6,7,8]]
I want to divide the elements in the list randomly while shuffling, but I don't know how to do it, so I leave a question like this. I'd appreciate your help.
python python-2.7
© 2024 OneMinuteCode. All rights reserved.