PYTHON ~ Enhancement Proposals ( PEPs )steemCreated with Sketch.

in #python5 years ago (edited)

PYTHON

Published with SteemPeak

ScreenshotScreenshot by Willi Glenz

SUMMARY

01 PYTHON ............................................................. v6 19-07 

02 installation ....................................................... v3 19-07
03 tutorials .......................................................... v4 19-07 
08 console ............................................................ v1 19-07
04 pycharm ............................................................ v1 19-07 
06 keywords ........................................................... v1 19-07
07 cheat sheet ........................................................ v3 19-07 update
09 peps ............................................................... v1 19-07 new

05 sources ............................................................ v2 19-07

#09

09 PEPs
PEP-008 Style Guide for Python Code .............. python.org/dev/peps/pep-0008/
PEP-257 Docstring Conventions .................... python.org/dev/peps/pep-0257/
Source  : python.org/dev/peps/


08 CONSOLE
$ python3
>>> help()
>>> <ctrl-d>
Documentation           : docs.python.org/3.7/contents.html
Help                    : help()


07 CHEAT SHEET
#COMMENTS
    # 
    """ ... """ 
    ''' ... '''

#PRINT
    print('Hello, World!')
    print('Hello, World! ', end='')
    print('Hello, World! ', end='\n')
    docs.python.org/3.7/library/functions.html#print

#OPERATORS
    + - * / // % **
    = += -= *= /= //= **=

#CONSTANTS
    True False None
    docs.python.org/3.7/library/constants.html

#VARIABLES
    x = 64
    print('x =', x)
    print('x = ' + str(x))
    x = 0b1000000
    print('x =', x)

#INPUT
    inp = input('Input: ')

#IF
    if x = 1:
        ...
    elif x > 1:
        ...
    else:
        ...

#FOR
    for i in [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]:
        print(i, end=' ')
    for i in range(10):
        print(i, end=', ')

#WHILE
     n = 10
     while n > 0:
        print(n)
        n -= 1

#FUNTIONS
    def fib(n):
        """ Calculate Fibonacci Numbers """
        a, b = 0, 1
        while a < n:
            print(a, end=' ')
            a, b = b, a+b
        print()
    def fib2(n):
        """ Calculate Fibonacci Numbers """
        a, b = 0, 1
        result = []
        while a < n:
            result.append(a)
            a, b = b, a+b
        return result
    docs.python.org/3.7/tutorial/controlflow.html

#STRINGS
    msg = 'Hello, World!'
    print(msg)
    print(msg[5])
    print(msg[0:5])
    print(msg[0:5:2])
    print(msg.lower())

#LISTS
    dummy_list = []
    dummy_list = ['a', 'b', 'c']
    dummy_list = [1, 'xyz', 2.0]
    print(dummy_list)
    print(dummy_list[-1])

#TUPLES
    dummy_tuple = ('abc', 'xyz', 123)
    print(dummy_tuple)
    print(dummy_tuple[-1])

#SETS
    dummy_set_0 = {1, 2, 'abc'}
    dummy_set_1 = {1, 2, 3, 4, 5}
    dummy_set_2 = {1, 7, 9, 11, 5}
    print(dummy_set_0)
    print(dummy_set_1 | dummy_set_2)
    print(dummy_set_1 & dummy_set_2)
    print(dummy_set_1 - dummy_set_2)
    print(dummy_set_1 ^ dummy_set_2)

#DICTIONARIES
    dummy_dict = {}
    dummy_dict = {1:7, 2:23, 3:18, 4:9, 99:0}
    dummy_dict[1] = 8
    del dummy_dict[99]
    dummy_dict[5] = 12
    print(dummy_dict)
    
Tutorial                : docs.python.org/3.7/tutorial/index.html
Documentation           : docs.python.org/3.7/contents.html
Language Reference      : docs.python.org/3.7/reference/index.html
Setup and Usage         : docs.python.org/3.7/using/index.html


06 KEYWORDS
import keyword
print(keyword.kwlist)

['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
Source          : docs.python.org/3.7/library/keyword.html


05 SOURCES
Jetbrains               : jetbrains.com
Python.org              : python.org
University of Waterloo  : uwaterloo.ca
Wingware                : wingware.com


04 PYCHARM
Download                : jetbrains.com/pycharm/
Documentation           : jetbrains.com/pycharm/documentation
Quick Start             : jetbrains.com/help/pycharm/quick-start-guide.html
Homepage                : jetbrains.com


03 TUTORIALS
Python 3 Tutorial (de)  : python-kurs.eu/python3_kurs.php

Chuck Severance     
   Videos               : youtube.com/playlist?list=PLlRFEj9H3Oj7Bp8-DfGpfAfDBiblRfl5p
   Book                 : py4e.com/book
   Free Online Course   : py4e.com

Python from Scratch     : open.cs.uwaterloo.ca/python-from-scratch/
Tutorial                : docs.python.org/3/tutorial/index.html
Dive Into Python 3      : file:///usr/share/doc/diveintopython3/html/index.html
Tutorial                : file:///usr/share/doc/python3.5/html/tutorial/index.html
Homepage                : python.org
Download                : python.org/downloads/
Documentation           : docs.python.org/3.7/


02 INSTALLATION
# snap install pycharm-community --classic
# apt install python3 idle3 spyder3 python-pip diveintopython3
$ which python; python -V
$ which python3; python3 -V
$ python3
$ python -m SimpleHTTPServer


INSTALLATION v3.7.4

$ mkdir ~/tmp; cd ~/tmp;
$ wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
$ xz --uncompress Python-3.7.4.tar.xz
$ tar -xf Python-3.7.4.tar
$ rm Python-3.7.4.tar
$ cd Python-3.7.4/
$ view README.rst
$ ./configure
$ make
$ make test
# make install
$ rm -r ~/tmp; ls -lisa ~

UPDATE-ALTERNATIVE

$ python<tab><tab>
$ python --version
# update-alternatives --list python
# update-alternatives --install /usr/local/bin/python3 python /usr/bin/python3.7 1
# update-alternatives --config python
# update-alternatives --list python
$ python --version

# update-alternatives --remove python /usr/bin/python2.7
Homepage                : python.org
Download                : python.org/downloads/release/python-374/
Documentation           : docs.python.org/3.7/


01 PYTHON
CheatSheet              $ cheat.sh/python/:learn
IDE                     : PyCharm Spyder3 Wing
Version                 $ python -V && python3 -V

DIVE-INTO-PYTHON-3

# apt install diveintopython3
$ dpkg -L diveintopython3 | grep -i index
> /usr/share/doc/diveintopython3/html/index.html
> file:///usr/share/doc/diveintopython3/html/index.html
Homepage                : python.org
Download                : python.org/downloads/
Documentation           : docs.python.org/3.7/

Coin Marketplace

STEEM 0.27
TRX 0.12
JST 0.032
BTC 66041.52
ETH 3064.94
USDT 1.00
SBD 3.69