Answers for "how to add an element to a tuple in python"

1

add item to tuple python

>>> T1=(10,50,20,9,40,25,60,30,1,56)
>>> L1=list(T1)
>>> L1
[10, 50, 20, 9, 40, 25, 60, 30, 1, 56]
>>> L1.append(100)
>>> T1=tuple(L1)
>>> T1
(10, 50, 20, 9, 40, 25, 60, 30, 1, 56, 100)
Posted by: Guest on January-28-2021
0

how to add items to tuple in python

programming_languages = ("python","c#","c++","c","java","javascript","assembly")
p_l = list(programming_languages)
p_l.append("pascal")
programming_languages = tuple(p_l)
print(programming_languages)
Posted by: Guest on December-29-2021
0

add one element to tuple python

a = ('2',)
b = 'z'
new = a + (b,)
Posted by: Guest on August-04-2020

Code answers related to "how to add an element to a tuple in python"

Browse Popular Code Answers by Language