You are on page 1of 3

1.

Input:

t=tuple()
print(t)

Output:

2.

Input:

list1 = [bharatnatyam]

res = [(val, pow(val, 3)) for val in list1]

print(res)

Output:

3.

Input:

a = (23,45,56,68,10,45,7,9)
print("Original A :",a)
b = list(a)
b.remove(56)
a = tuple(b)
print("After Removing A :",a)
print(type(t))

Output:

4.

Input:

def Reverse(tuples):
new_tup = tuples[::-1]
return new_tup

tuples = ('z','a','d','f','g','e','e','k')
print(Reverse(tuples))
Outputs:

5.

Input:

numtup = (11, 33, 55, 77, 99, 111, 77, 121, 13, 55, 77)
print(numtup)

index1 = numtup.index(33)
print("Index Position of 33 = ", index1)

index2 = numtup.index(77)
print("Index Position of 77 = ", index2)

index3 = numtup.index(77, 4)
print("Index Position of 77 = ", index3)

index4 = numtup.index(77, 7)
print("Index Position of 77 = ", index4)

Output:

6.

Input:

tuplex = tuple("devika")
print(tuplex)

print(len(tuplex))

Output:

8.

Input:

numbers = tuple()
n = int(input("How many numbers you want to enter?: "))
print("Enter any ",n," numbers")
for i in range(0,n):
num = int(input())

numbers = numbers +(num,)


print('\nThe numbers in the tuple are:')
print(numbers)
print("\nThe maximum number is: ")
print(max(numbers))
print("The minimum number is: ")
print(min(numbers))
print("The sum of numbers is: ")
print(sum(numbers))
print("The mean of numbers is: ")
mean = sum(numbers)/(i+1)
print(mean)
ele=int(input("Enter the element to be searched: "))
if ele in numbers:
print("Element found")
else:
print("Element not found")'

Output:

9.

Input:

listx = [5, 10, 7, 4, 15, 3]


print(listx)

tuplex = tuple(listx)
print(tuplex)

Output:

10.

Input:

tuple1 = ("a", "b" , "c")


tuple2 = (1, 2, 3)

tuple3 = tuple1 + tuple2


print(tuple3)

Output:

You might also like