Write a Python Program to Create a Tuple with Numbers or a numeric tuple. The first one will create a tuple with 22 as a value.
# Example
nTuple = 22,
print("Tuple Items = ", nTuple)
numTuple = (10, 20, 40, 60, 80, 100)
print("Tuple Items = ", numTuple)
Tuple Items = (22,)
Tuple Items = (10, 20, 40, 60, 80, 100)
In this program, we created an empty tuple, and it allows the user to enter the tuple items. Within the loop, we concatenate each numeric tuple item to an already declared Python tuple. Please refer to the Python tutorial and its Python examples.
intTuple = ()
number = int(input("Please enter the Total Tuple Items to store = "))
for i in range(1, number + 1):
value = int(input("Please enter %d Tuple Item = " %i))
intTuple += (value,)
print("Tuple Items = ", intTuple)

Also Read
- Python Program to Check Item exists in Tuple
- Python Program to Find Sum of Even and Odd Numbers in Tuple