Using a for loop with append method you can create a new list in for loop Python.
Example creating a new list for each for loop in Python
Python simple example code creates and fills a list of lists in for a loop. This example will generate a new list from variables in a loop.
For each iteration in the loop multiplying the value by 10.
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] list2 =  for number in list1: calc = number * 10 list2.append(calc) print(list2)
Another example List comprehensions
It provides a more compact way to write this pattern.
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] list2 = [number * 10 for number in list1] print(list2)
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Do comment if you have any doubts and suggestions on this Python list topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.