Python · Sequences: Lists & Tuples

What does this print? ``` lst = [1, 2, 3, 4] for x in lst: if x % 2 == 0: lst.remove(x) print(lst) ```

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 is the idiomatic way to reverse a sequence with a slice, and what does it return?
What does this print, and what's the key fact about the result? ``` s1 = ["thesis"] s2 = s1[:] print(s1 == s2, s1 is s2) ```

Start learning today

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

Get it on App StoreGet it on Google Play