Computer Science, asked by shantanugarg99, 2 months ago

Give the output of following : a=[2,7,9,13,28] print(a[2:]+a[:2])​

Answers

Answered by jai696
2

\huge\red{\mid{\fbox{\tt{ANSWER}}\mid}}

[9, 13, 28, 2, 7]

\huge\blue{\mid{\fbox{\tt{Explanation}}\mid}}

a[2:] slices items starting from index 2 to till end of list.

a[:2] slices items from the start of list and stops at index 2

print(a[2:] + a[:2]) concatenates the result of both the slices into a new list and prints the result

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions