python basics cheat sheet code example

Example 1: python cheat sheet

Best Python Cheat Sheet PDF:
https://websitesetup.org/wp-content/uploads/2020/04/Python-Cheat-Sheet.pdf

Example 2: cheat sheet python

def foo():
    """
    This is a function docstring
    You can also use:
    ''' Function Docstring '''
    """

Example 3: cheat sheet python

>>> print('I am {} years old.'.format(str(29)))
I am 29 years old.

Example 4: cheat sheet python

>>> 2 + 3 * 6
20

Example 5: cheat sheet python

a = 1  # initialization

Example 6: cheat sheet python

>>> print('Hello world!')
Hello world!