python - Appending nested list data to another nested list based on user input -
i trying work out how append data 1 nested list another. familiar .append(). problem arises because want user able choose piece of data append.
so have 2 nested lists this:
list_one = [['example', 'example', '000', 'example'],['example', 'example', '000', 'example']]
i want this... user_input = input("enter number: ")
if user entered 1 take data nested list @ index , append data list.
i don't want data sliced either. want whole ['example', 'example', '000', 'example']
appended list.
list_one = [['example', 'example', '000', 'example'], ['example', 'example', '001', 'example']] list_out = [] user_input = input("enter number: ") list_out.append(list_one[int(user_input)])
Comments
Post a Comment