Q. Change the above code so that it works as stated in previous question.


Answer :-


NumLst = [2, 5, 1, 7, 3, 6, 8, 9]
SqLst = [ ]

for i in NumLst :
    SqLst .append( i * 2 )
print (SqLst)


Output :-

[4, 10, 2, 14, 6, 12, 16, 18]
>>>

2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post