Q. Write a program to print every 3rd element of a tuple T, raised to power 3.


Answer =


T = eval(input("Enter a tuple :-"))
for index in range (2, len(T), 3) :
    print(T [ index ] ** 3)

Note :- Enter a list that contain at-least three elements

 

Output :- 

(i)

Enter a tuple :-[1,2,3,4,5,6,7,8,9]
27
216
729

>>> 

(ii)

Enter a tuple :-[1,5,9]
729

>>> 

16 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post