Python will throw an error if you use any the following keywords as a variable name.
See this page for more details: Keywords.
Built-in functions
You should avoid using the following functions names in your code, neither as a variable name nor as a function name.
See this page for more details: Built-in Functions.
Variables
Variables names:
Variables names can contain only letters, numbers, and/or underscores.
Variables names can't start with a number.
Define a variable:
Multiple assignment:
Comments
To comment a line or part of a line, use the hash mark character (#).
Using underscores between digits in numeric literals:
Modulo operator:
Strings
Changing string case:
Formating a string (f-strings):
To use a variable or a function inside a string, place the letter f before opening quotation mark.
Inside the string put any variable or function you want to use and surround it with braces.
Adding whitespace to strings with tabs (\t) or newlines (\n):
Stripping whitespace:
Removing prefixes and suffixes:
Split words:
Split lines:
Convert string to int:
Dates
Parsing a string date using a specific format:
Date and time formating: