# basic

* [version capatibility](#version-capatibility)
* [environment](#environment)
  * [list included modules](#list-included-modules)
  * [list lib paths](#list-lib-paths)
* [Positional notation](#positional-notation)
  * [to Binary](#to-binary)
  * [to Octal](#to-octal)
  * [to Decimal](#to-decimal)
  * [to Hexadecimal](#to-hexadecimal)
* [The Big Book of Small Python Projects](#the-big-book-of-small-python-projects)

### version capatibility

**Supported Ubuntu and Python Versions**

> \[!NOTE|label:references:]
>
> * [Ubuntu releases](https://ubuntu.com/about/release-cycle)
> * NOTE: Python2.7 (all), Python 3.6 (bionic), Python 3.8 (focal), Python 3.10 (jammy) are not provided by deadsnakes as upstream ubuntu provides those packages.

|      -      | UBUNTU 18.04 ( BIONIC ) | UBUNTU 20.04 ( FOCAL ) | UBUNTU 22.04 ( JAMMY ) |
| :---------: | :---------------------: | :--------------------: | :--------------------: |
|  python 2.3 |            ✔            |                        |                        |
|  python 2.4 |            ✔            |                        |                        |
|  python 2.5 |            ✔            |                        |                        |
|  python 2.6 |            ✔            |                        |                        |
|  python 2.7 |            ✔            |                        |                        |
|  python 3.1 |            ✔            |                        |                        |
|  python 3.2 |            ✔            |                        |                        |
|  python 3.3 |            ✔            |                        |                        |
|  python 3.4 |            ✔            |                        |                        |
|  python 3.5 |            ✔            |            ✔           |                        |
|  python 3.6 |            ✔            |            ✔           |                        |
|  python 3.7 |            ✔            |            ✔           |            ✔           |
|  python 3.8 |            ✔            |            ✔           |            ✔           |
|  python 3.9 |            ✔            |            ✔           |            ✔           |
| python 3.10 |            ✔            |            ✔           |            ✔           |
| python 3.11 |            ✔            |            ✔           |            ✔           |
| python 3.12 |            ✔            |            ✔           |            ✔           |

### environment

#### list included modules

```python
$ python -c 'help("modules")'

Please wait a moment while I gather a list of all available modules...

__future__          _warnings           graphlib            runpy
_abc                _weakref            grp                 sched
_aix_support        _weakrefset         gzip                secrets
...
```

#### list lib paths

```python
$ python -c 'import sys; print (sys.path)'
['', '/usr/lib/python39.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']
```

### [Positional notation](https://en.wikipedia.org/wiki/Positional_notation)

#### to Binary

*   octal to binary

    ```python
    >>> bin( int('0o10', 8) )
    '0b1000'
    >>> bin( int('0o17', 8) )
    '0b1111'
    ```
*   decimal to binary

    ```python
    >>> bin(2)
    '0b10'
    >>> bin(10)
    '0b1010'
    ```

    *   or

        ```python
        >>> format( 3, 'b' )
        '11'
        >>> format( 15, 'b' )
        '1111'
        ```
* hexadecimal to binary

```python
>>> bin( int('a', 16) )
'0b1010'
>>> bin( int('f', 16) )
'0b1111'
```

#### to Octal

*   binary to octal

    ```python
    >>> oct( int(str(111), 2) )
    '0o7'
    >>> oct( int(str(1000), 2) )
    '0o10'
    ```
*   decimal to octal

    ```python
    >>> oct(8)
    '0o10'
    ```

    *   or

        ```python
        >>> format( 15, 'o' )
        '17'
        >>> format( 8, 'o' )
        '10'
        ```
*   hexadecimal to octal

    ```python
    >>> oct( 0xf )
    '0o17'
    ```

#### to Decimal

*   binary to decimal

    ```python
    >>> int( str(11), 2 )
    3
    >>> int( str(1010), 2 )
    10
    ```
*   octal to decimal

    ```python
    >>> 0o10
    8
    >>> int( 0o10 )
    8
    >>> int ( str(10), 8 )
    8
    ```
*   hexadecimal to decimal

    ```python
    >>> int( 0xf )
    15
    ```

#### to Hexadecimal

*   binary to hexadecimal

    ```python
    >>> hex( int(str(1010), 2) )
    '0xa'
    >>> hex( int(str(1111), 2) )
    '0xf'
    ```
*   octal to hexadecimal

    ```python
    >>> hex(0o10)
    '0x8'
    >>> hex( int('0o17', 8 ))
    '0xf'
    ```
*   decimal to hexadecimal

    ```python
    >>> hex(15)
    '0xf'
    >>> hex(66)
    '0x42'
    ```

    *   [or](https://stackoverflow.com/a/16414603/2940319)

        ```python
        >>> format( 15, 'x' )
        'f'
        ```
    *   [or](https://stackoverflow.com/a/10218221/2940319)

        ```python
        >>> '%x' % 15
        'f'
        ```

### [The Big Book of Small Python Projects](https://inventwithpython.com/bigbookpython/)

> \[!NOTE|label:references:]
>
> * [The Big Book of Small Python Projects](https://inventwithpython.com/bigbookpython/)
> * [THE BIG BOOK OF SMALL PYTHON PROJECTS.pdf](https://edu.anarcho-copy.org/Programming%20Languages/Python/BigBookSmallPythonProjects.pdf)
> * [nihathalici/The-Big-Book-of-Small-Python-Projects](https://github.com/nihathalici/The-Big-Book-of-Small-Python-Projects/tree/main)
