CH2 - Variables & Simple Data Types Flashcards
Variable
Reserved memory location to store values
.py
Python file extension
Syntax highlighting
Makes the code more readable, and It can also help identify problems with examples.
Rules for naming variables in python
- Must start with a letter or the underscore character.
- A variable name cannot start with a number.
- Can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
- Names are case-sensitive.
- No spaces.
- Do not use Python keywords.
- Must be short and descriptive.
Traceback error
A record of where the IDE had trouble running the code.
Strings
Characters inside quotes.
Integers
Whole numbers, no fractions.
Floats
Numbers with a decimal point
Operations with Integers and Floats
The result will always be a float.
F-String
How to insert variable values into a string.
Methods
Action that Python performs on data.
.tittle()
Python method. Title case string.
.lower()
Python method. lower case string.
.upper()
Python method. upper case string.
\t
Tab. adds a tab space into text.