Python Flashcards
f-strings
formatted strings in python. Use the curlies [] as a placeholder for variables. Syntax: f” This is a string. This is a [object].”
data types
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.
Boolean Operators
There are operations in python that evaluate to a Boolean. Eg, =, <, >, >=, !=, <=, …
3 + 3 == 6 evaluates to True.
If/Else Conditions
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
What is the assignment operator in Python?
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