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,923 questions

51,856 answers

573 users

How to append list to another list in Python

4 Answers

0 votes
lst1 = [34, 78, 90, 'python', 'java', 7.35]

lst2 = [7, 'c++', 99, 'c']

lst1.extend(lst2)
  
print(lst1) 




'''
run:

[34, 78, 90, 'python', 'java', 7.35, 7, 'c++', 99, 'c']

'''

 



answered Jan 10, 2021 by avibootz
0 votes
lst1 = [34, 78, 90, 'python', 'java', 7.35]

lst2 = [7, 'c++', 99, 'c']

for item in lst2:
    lst1.append(item)
  
print(lst1) 




'''
run:

[34, 78, 90, 'python', 'java', 7.35, 7, 'c++', 99, 'c']

'''

 



answered Jan 10, 2021 by avibootz
0 votes
lst1 = [34, 78, 90, 'python', 'java', 7.35]
 
lst2 = [7, 'c++', 99, 'c']
 
lst1 = lst1 + lst2
   
print(lst1) 
 
 
 
 
'''
run:
 
[34, 78, 90, 'python', 'java', 7.35, 7, 'c++', 99, 'c']
 
'''

 



answered Mar 20, 2023 by avibootz
0 votes
lst1 = [34, 78, 90, 'python', 'java', 7.35]
 
lst2 = [7, 'c++', 99, 'c']
 
lst1.append(lst2)
   
print(lst1) 
 
 
 
 
'''
run:
 
[34, 78, 90, 'python', 'java', 7.35, 7, 'c++', 99, 'c']
 
'''

 



answered Mar 20, 2023 by avibootz

Related questions

1 answer 130 views
2 answers 167 views
1 answer 143 views
1 answer 128 views
2 answers 152 views
1 answer 117 views
1 answer 107 views
...