>>list_numbers = [12,6,8,78]
>>list_numbers[::-1]
[78, 8, 6, 12] # Reverse a List
>>list_numbers[-1:]
[78]
>>list_numbers[:-1]
[12, 6, 8] #Remove a last number
>>list_numbers[-1::]
[78]
>>list_numbers[-2::]
[8, 78] # Last Two Element
>>list_numbers[:-2]
[12, 6]
###########################################
Two List match one to end
list_b = [5, 6, 7, 8,34]
list_a = [1, 2, 3, 4, 90,80]
c = map(lambda x,y:[x,y],list_a,list_b)
for i in c:
print(i)
>>list_numbers[::-1]
[78, 8, 6, 12] # Reverse a List
>>list_numbers[-1:]
[78]
>>list_numbers[:-1]
[12, 6, 8] #Remove a last number
>>list_numbers[-1::]
[78]
>>list_numbers[-2::]
[8, 78] # Last Two Element
>>list_numbers[:-2]
[12, 6]
###########################################
Two List match one to end
list_b = [5, 6, 7, 8,34]
list_a = [1, 2, 3, 4, 90,80]
c = map(lambda x,y:[x,y],list_a,list_b)
for i in c:
print(i)
Comments
Post a Comment