Python · Sequences: Lists & Tuples

What is the idiomatic way to reverse a sequence with a slice, and what does it return?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Sequences: Lists & Tuples

What does this print? ``` s = "haystackNEEDLE" print(s[8:14]) ```
What does this print? ``` name = "Python" print(name[-2]) ```
What does this print? ``` s = "Much less" print(s[1337:2674]) print(s[100]) ```
What does this print? ``` name = "ytnoM Python" print(name[4::-1]) ```
What does this print, and what's the key fact about the result? ``` s1 = ["thesis"] s2 = s1[:] print(s1 == s2, s1 is s2) ```
What does this print? ``` x = [["nice"]] * 3 x[0][0] = "oops" print(x) ```

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play