Python have this feature called list comprehension, it allow to create new list using a more concise syntax than for loop. Without list comprehension: num = [1,2,3,4,5] squared = [] for n in num: squared.append(n**2) print(squared) # [1,4,9,16,25...
alexdoff.hashnode.dev1 min read
No responses yet.