1. Help Center
  2. Python Programming

How will you merge elements in a sequence?

There are three types of sequences in Python:
 
Lists
Tuples
Strings
Example of Lists -
 
>>l1=[1,2,3]

 

>>l2=[4,5,6]

 

>>l1+l2

 

Output: [1,2,3,4,5,6]

 

 
Example of Tuples -
 
>>t1=(1,2,3)

 

>>t2=(4,5,6)

 

>>t1+t2

 

Output: (1,2,3,4,5,6)

 

 
Example of String -
 
>>s1=“Sim”

 

>>s2=“ple”

 

>>s1+s2

 

Output: ‘Simple’