What will be the output of the following in Python?
(Note:click on Question to enlarge)
t=[1,2,4,3]
print(t[1:3])
(1,2)
(1,2,4)
(2,4,3)
(2, 4)
Answers
Answered by
3
Required Answer:-
Given Cσde:
t=[1,2,4,3]
print(t[1:3])
To Find:
- The output of the given cσde.
Output:
- [2,4]
Explanation:
- Given List: t = [1,2,4,3]
- t{1:3} displays elements of the list in the range 1 (starting range) to 2(ending range -1, 3 is ignored).
- Elements in the index range 1 - 2 are - 2 and 4.
- Therefore, output: [2,4]
Refer to the attachment.
•••♪
Attachments:
Similar questions