Python Flashcards

1
Q

f-strings

A

formatted strings in python. Use the curlies [] as a placeholder for variables. Syntax: f” This is a string. This is a [object].”

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

data types

A

Python stores data in different types. Eg.. text is stored in strings, numbers are stored in integers or floats. Booleans are used to represent True or False.

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

Boolean Operators

A

There are operations in python that evaluate to a Boolean. Eg, =, <, >, >=, !=, <=, …
3 + 3 == 6 evaluates to True.

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

If/Else Conditions

A

If/else conditionals always start with an if block, everything else is optional. To chain them together use elif until the last else block.
Syntax:
if conditional:
—-body of the if block

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

What is the assignment operator in Python?

A

To assign values to an object, use the equal sign. The label goes on to the left, and the value goes on the right. Example: > name = cool

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