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
>>>
program is not working at all
ReplyDeletePlease Check again.
DeleteYou should enter the tuple in tuple format like (2,4,5)
Deletenotworking
ReplyDeletePlease Check again.
DeleteNot working
ReplyDeleteEnter a list of at-least three elements.
DeleteIts working :D
ReplyDelete😊😊
Deleteworks ty
ReplyDeleteWelcome : )
Deletebut,we have to use while loop in this program
ReplyDeleteNo, it is not necessary
Deleteplease upload it by while loop
Deletei=2
Deletewhile ( i < len(lst)):
print(i**3)
i += 3
Who is Sumita???
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )