Write a program to input ‘n’ numbers and separate the tuple in the following manner.
Example
T=(10,20,30,40,50,60)
Tl=(10,30,50)
T2=(20,40,60)
Answers
Answered by
1
HEYA MATE YOUR ANSWER IS
T1=(10,30,50)
HOPE THIS HELPS ❤️
PLEASE MARK AS BRAINLIEST ❤️❤️
Answered by
2
The program of the given question is as follows:
A = tuple ( ) // built-in method to create tuples
X = input(” Enter : ”) // input from the user
for y in range (X) : //for loop
p = input(“enter the list of elements”) // user inputs the numbers
A = A + ( p, )
A1 = A2 = tuple( )
for i in A : //for loop
if i%2 = = 0:
A2 = A2 + ( i, )
else:
A1 = A1 + ( i, )
print (“A1 Tuple is = ” , A1) //output gets printed
print (“A2 Tuple is = ” , A2) // output gets printed
Similar questions