If statements Flashcards
1
Q
What is the correct syntax for creating a basic if statement in Python?
A
Indentation
if num in nums:
return True
2
Q
What is the correct syntax for if, else if, and else in Python?
A
if, elif, else
3
Q
How do you do “logical and” and “logical or” in Python?
A
and, or (other languages are &&, ||)
4
Q
What is the correct syntax when doing multiline conditionals?
A
if ((n > 2 and
n != m) or n == m):
n += 1