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 an {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. For e.g., text is stored in strings, numbers are stored in integers or floats. Booleans are used to represent True or Flase.

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. E.g.: =, <, >, >=, 1=, <=, …
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
6
Q

Function

A

Single input with one output

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