How to create a tuple character and number combined as value in Python

1 Answer

0 votes
t = tuple(f"x{n}" for n in range(10))
 
print(t)
 
 
'''
run:

('x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9')
 
'''

 



answered Dec 2, 2019 by avibootz
...