0
Not sure how to create a python function for this.
I have a list Eg. Y=([123,4325,1234,34567],[123,3425,532,3456],etc) Result = [i for i in Y if i[0]<i[1]<i[2]<i[3]] Print(Result) It will give the result that I want for only 4 element For this portion i[0]<i[1]<i[2]<i[3]] , I will like to have it change to whatever I wanted the amount of element using input instead of just 4 elements Any suggestions?
2 Respostas
+ 3
Maybe this is what you are looking for
Result = [i for i in Y if all([i[j]<i[j+1] for j in range(len(i)-1)])]
print(Result)
0
Thanks. What about I wanted to change into a def function for the below.
Result = [i for i in Y if i[0]<i[1]<i[2]<i[3]]
Print(Result)