Code Structure Flashcards
1
Q
Continue lines with “"
A
Put \ at the end of the line, and Python acts as if you are on the same line.
Alphabet = ‘abcde’ + \
‘defgh’
2
Q
If and else = Python statements
A
Check whether a condition is True.
Indent 4 spaces. (PEP-8) style
Disaster = True
If disaster:
Print(“Woe”)
Assigned the Boolean value True to variable disaster.
Performed a conditional comparison .
Called the print function.
3
Q
Comment with “#’
A
Python ignores everything after the “#”
Called hash, hashtag, sharp , pound, octothorpe.
4
Q
Comparison operators
A
Equality - == Inequality - != Less than - Greater than or equal - >= Membership - in
These all return the Boolean value of True or False.