How to initialize a tuple in Python

1 Answer

0 votes
tpl = ('python', 8976, 3.14, 'x', 'y', [12, 13, 14, 15, 16])

print(tpl)
print(tpl[0])
print(tpl[5])
print(tpl[5][0])




'''
run:

('python', 8976, 3.14, 'x', 'y', [12, 13, 14, 15, 16])
python
[12, 13, 14, 15, 16]
12

'''

 



answered Apr 27, 2021 by avibootz
...