Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,960 questions

51,902 answers

573 users

How to use list.append(obj) in Python

2 Answers

0 votes
lst = [123, 'C++', 'PHP', 'Python']
lst.append(3000)
print(lst)

'''
run:

[123, 'C++', 'PHP', 'Python', 3000]

'''

 



answered Mar 4, 2016 by avibootz
0 votes
lst2d = [[], []]

lst2d[0].append(1)
lst2d[0].append(22)

lst2d[1].append(3)
lst2d[1].append(444)

print(lst2d)

for row in lst2d:
    for column in row:
        print(column, end=" ")
    print(end="\n")

'''
run:

[[1, 22], [3, 444]]
1 22
3 444

'''

 



answered Mar 4, 2016 by avibootz

Related questions

1 answer 208 views
1 answer 128 views
2 answers 153 views
1 answer 118 views
1 answer 107 views
3 answers 155 views
...