Knowee
Questions
Features
Study Tools

What will be the output of below Python code?list1=[8,0,9,5]print(list1[::-1])[5,9,0,8][8,0,9][8,0,9,5][0,9,5]

Question

What will be the output of below Python code?list1=[8,0,9,5]print(list1[::-1])[5,9,0,8][8,0,9][8,0,9,5][0,9,5]

🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of the given Python code will be [5,9,0,8]. This is because the slicing operation list1[::-1] returns a reversed copy of the original list.

Similar Questions

What is the output of the following Python code?list1=[80,90,100,120]print(list1[::-2])

Which of the following will give output as [23,2,9,75] ?If list1=[6,23,3,2,0,9,8,75]print(list1[1:7:2])print(list1[0:7:2])print(list1[1:8:2])print(list1[0:8:2])

What will be the output of the givencode?a. List=[‘p’,’r’,’i’,’n’,’t’,]b. Print list[8:]

What is the output of below code snippeta = [ [8, 2] , [4, 1, 2, 2] ]b = a[1][2:]print(b)

What would be the output of the following Python statement?[11, 12, 13, 14, 15, 16, 17, 18, 19, 10][8:4:-1]

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.