Python · Control Structures

Which of these are 'falsy' in an if condition: 0, "", [], {}, None, "0"?

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 Control Structures

Why does (n := len(lst)) usually need parentheses inside a bigger expression?
What does this print? ``` for n in [2, 4, 6]: if n == 5: break else: print("done") ```
A for/while loop's else branch runs in which case: when the loop hits break, or when it does NOT?
break vs continue inside a loop: what does each do?
What is printed? ``` n = 5 while n > 0: n -= 1 if n == 2: continue print(n, end=" ") ```
What is the value of var? ``` x = 7 var = 20 if x == 1 else 30 ```

Start learning today

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

Get it on App StoreGet it on Google Play