#Like I have a list
lst=[1,4,5,2,6]
What will be the code . (with for loop)
If i need the the output: list*2
#Like I have a list
lst=[1,4,5,2,6]
What will be the code . (with for loop)
If i need the the output: list*2
for i in range(len(list)):
lst[i]=list[i]*2
print(lst)
numbers = [1, 4, 5, 2, 6]
multiplied = []
for number in numbers:
multiplied.append(number * 2)
print(multiplied)
Output : - [2,8,10,4,12]