Python Program to Create a Tuple with Numbers

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 Python program, we created an empty tuple, and it allows the user to enter the tuple items. Within the loop, we are concatenation each numeric tuple item to an already declared tuple.

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)
Python Program to Create a Tuple with Numbers 2