can we input the some values using lists by mentioning the no of values....like in c++... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

can we input the some values using lists by mentioning the no of values....like in c++...

learning lists

29th Jan 2018, 1:18 PM
PRO
PRO - avatar
3 Answers
+ 3
ohk...thx...
29th Jan 2018, 2:17 PM
PRO
PRO - avatar
+ 2
plz answer me...
29th Jan 2018, 2:10 PM
PRO
PRO - avatar
+ 2
No, you can't. You can initialize an empty list: ls = [] Or initialize a list with elements: ls = [1, 2, 3] Remember, you can add values to a list by using append(): ls = [] ls.append(1) # list is now [1]
29th Jan 2018, 2:16 PM
LunarCoffee
LunarCoffee - avatar