How to create a tuple from a string and a list in Python

1 Answer

0 votes
_str = 'python'

lst = ['c', 'c++', 'c#']

tpl = (_str,) + tuple(lst)

print(tpl) 

 
   
   
   
'''
run:
   
('python', 'c', 'c++', 'c#')
 
'''

 



answered Jul 24, 2022 by avibootz
...