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’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Comment with “#’

A

Python ignores everything after the “#”

Called hash, hashtag, sharp , pound, octothorpe.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly