Build list in Python -


i have list ['15663627', '5904116', '7162142', '9854216', '55024914'] in return want ['15663627', '5904116'], ['15663627','7162142'] etc. should first element every next...

what im getting examples you're looking this?..

def custom_sequence_1(input_list):     output=[]     in range(len(input_list)-1):         output.append(list(set([input_list[i+1],input_list[0]]))) return(output)  print(custom_sequence_1(['15663627', '5904116', '7162142', '9854216', '55024914']))  #outputs: [['15663627', '5904116'], ['15663627', '7162142'], ['15663627', '9854216'], ['15663627', '55024914']]   # or little more specific wording: def custom_sequence_2(input_list):     output=[]     first=input_list[0]     in input_list:         output.append([first,i])     output.pop(0)     return(output)  print(custom_sequence_2(['15663627', '5904116', '7162142', '9854216', '55024914']))  # outputs: [['15663627', '5904116'], ['15663627', '7162142'], ['15663627', '9854216'], ['15663627', '55024914']] 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -