Online, I saw a solution like this :
list = [1, 2, 3]
list_1 = [ i*2 for i in list]
Please, can someone give another way to solve that code? Thank You.
Online, I saw a solution like this :
list = [1, 2, 3]
list_1 = [ i*2 for i in list]
Please, can someone give another way to solve that code? Thank You.
you can use map
list(map(lambda x: x * 2 , [1,2,3]))
output
[2, 4, 6]