How to add data in list below?

i have a list :

List = [[['1','2'],['2','4']],[['1','4'],['4','8']],[['53','8'],['8','2'],['2','82']]]

That i want add reverse data to list

To be:

[[['1','2'],['2','4'],['2','1'],['4','2']],[['1','4'],['4','8'],['4','1'],['8','4']],[['53','8'],['8','2'],['2','82'],['8','53'],['2','8'],['82','2']]]

You can iterate over the list and extend it with the reversed elements:

List = [[['1','2'],['2','4']],[['1','4'],['4','8']],[['53','8'],['8','2'],['2','82']]]

for sublist in List:
    sublist.extend([pair[::-1] for pair in sublist])

In the end, List will be:

[[['1', '2'], ['2', '4'], ['2', '1'], ['4', '2']],
 [['1', '4'], ['4', '8'], ['4', '1'], ['8', '4']],
 [['53', '8'], ['8', '2'], ['2', '82'], ['8', '53'], ['2', '8'], ['82', '2']]]

You can fill your list by moving from top to bottom, like . Create Criterias List then Create movChannel object and add that list to Criterias object and so on; However if you want to avoid this way, there is another way. If you are using Linq To List then follow this. Get a simple flat object to a list object. var TableData = db.Tablename.Tolist();

You can use a nested list comprehension that iterates over the sub-lists and reverses sub-lists within, before merging them with the original sub-lists:

[l + [s[::-1] for s in l] for l in List]

In Excel, in the Chart Tools group, there is a function to add the data table to the chart. 1. Click on the data chart you want to show its data table to show the Chart Tools group in the Ribbon. See screenshot: 2. Click Layout > Data Table, and select Show Data Table or Show Data Table with Legend Keys option as you need. See screenshot:

While this answer may not be the most Pythonic of answers given the original intent of the function I use was for reverse iteration over sequences. This accomplishes your goal in a concise, readable fashion, imho.

I have made use of the function reversed(). This function will return a reverse-order list_reverseiterator object based on your original list. Considering this returned object is not a list, we can use the list type change function as such: list(reversed(List)) and this will provide you with the reversed original list. Then, the original candidate List is appended with the newly reversed list to create the desired output you had requested.

Source 1 Source 2

List = [[['1','2'],['2','4']],[['1','4'],['4','8']],[['53','8'],['8','2'],['2','82']]]
print("Here is the original list: ", List)
ListReverse = list(reversed(List))
List.append(ListReverse)
print("Here is your final list: ", List)

While the print statements are accessory to the original ask, I have included them so you have a verification of the working solution.

To create a drop-down list, start by going to the Data tab on the Ribbon and click the Data Validation button. The Data Validation window will appear. The keyboard shortcut to open the Data Validation window is Alt, A, V, V. You’ll want to select List in the drop-down menu under Allow.

How to Add Drop-Down List in Excel to an Entire Range of Cells. 1. Select the entire range of cells you want the drop-down list added to. 2. In the Data tab, go to Data Validation and select List from the Allow drop-down menu. 3. Tap the data button underneath the Source option. 4. Select the entire range you want the drop-down list added to

Now, select the cell into which you want to add a drop-down list and click the “Data” tab. In the Data Tools section of the Data tab, click the “Data Validation” button. The Data Validation dialog box displays. On the Settings tab, select “List” from the Allow drop-down list (see, drop-down lists are everywhere!).

Select cell B2, where the Client drop down list will appear On the Ribbon, click the Data tab, then click Data Validation. From the Allow drop-down list, choose List In the Source box, type an equal sign and the list name, for example:

Comments
  • Hi Joy, have you tried anything yet?
  • @YevhenKuzmovych No, unfortunately
  • Would be helpful for the OP if you explain the one liner. At least add some explanation to your answer. It always helps