Can we change objects of a list in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can we change objects of a list in python?

Consider we have an empty list .By using a loop,can we add objects to our list in python?

11th Jul 2019, 4:44 AM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
5 Answers
+ 6
you can find here some of your requested items. try and run code: https://code.sololearn.com/cOwT4iGHAwgG/?ref=app
11th Jul 2019, 10:25 AM
Lothar
Lothar - avatar
+ 3
you can use append() inside the loop https://docs.python.org/3/tutorial/datastructures.html
11th Jul 2019, 4:50 AM
Taste
Taste - avatar
+ 3
Lothar thanks for your code, it was a pack of useful instructions
11th Jul 2019, 1:35 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
+ 3
Taste thanks for mentioning the reference
11th Jul 2019, 1:38 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
+ 2
Yeah and you can use a list comprehension
11th Jul 2019, 7:05 AM
Trigger
Trigger - avatar