0
How to built a function where the parameter ecpect an integer in a list. Should look like this:
Input: [3,1,5] Output [[1,2,3], [1], [1,2,3,4,5]]
4 Respuestas
+ 3
you can define the parameters as you like
however is convenient for you
i used a string of numbers seperated by a comma ( , ) so i could split them and then build each array
0
Thank you! but why is there an error, when I write:
def f (vals):
vals = [3,1,5]
vals= vals.split (',')
valsList=[list (range (1,int (r)+1) for r in vals]
print (valsList)
f () #?
0
Ok I got it, but is it possible that the parameter must be a list with integers?