Python Punctuation Guide

Python uses most of the punctuation symbols on a computer keyboard. Here is a list of what the symbols are used for in Python.

Hashtag / Octothorpe #
    Comments

Parentheses ( )
    Function calls
    Order of operations
    Creating tuples

Square brackets [ ]
    Indexing and slicing
    Creating lists

Curly braces { }
    Creating dictionaries (dict)
    Expressions in f-strings

Backslash \
    Escape character in string literals

Quotes ' ' or " "
    String literals

Colon :
    Defines start of code block
    Remember to indent code blocks

Comma ,
    Separates items in a list literal
    Separates arguments (inputs) in a function call

Dot  .
    Access an attribute or function of an object
    object_name.function_name() - see example below
    my_list.remove("abc")

Underscore _
    Separates words in names of
    variables and functions