My Docs
BlogGithubLinkedin
Cheat Sheets
Cheat Sheets
  • πŸ“‹Cheat Sheets
    • Files
    • Terminal Cheat Sheet
    • Flexbox Cheat Sheet
    • Common HTTP status codes Cheat Sheet
    • networking_cheatsheet
    • Regular Expressions Cheat Sheet
    • REGEX units Cheat Sheet
  • bash_cheatsheet
  • Google dork cheatsheet
  • Cheatsheet-v2
  • πŸ•ΈοΈπŸ’» πŸ’» Javascript
    • JavaScript
      • Javascript Python cheatsheet
      • General
        • JavaScript Promise API Cheat Sheet
        • Chai.js
        • Canvas
        • ES6 EXPORTS
        • Asynchronous JavaScript Cheat Sheet
      • React
        • React Cheat Sheet
          • React Component Guide
        • React Patterns:
        • react-examples
        • React.js
          • Bootstrap
        • React.js cheatsheet 2
        • React-router
        • React.js (v0.14)
        • React.js
        • React Patterns:
      • βš–οΈLibraries & Frameworks
        • LOADASH Cheat Sheet
        • sequelize_cheatsheet
        • Sequelize Cheatsheet
      • Node & Express
        • ExpressJS Cheat Sheet
      • CHEATSHEET
      • NPM Cheat Sheet
        • NPM Command Line Cheat Sheet
      • Function Context Cheatsheet
      • js-model
  • πŸ’»CS-Concepts
    • Computer Science Concepts
      • Data Structures
        • The Queue data structure
        • Cheat Sheet for Beginners: JavaScript Data Structures Methods
        • MDN Web Docs Glossary: Definitions of Web-related terms \| MDN
        • Data Structures Cheat Sheet
        • The Tree data structure
        • An Executable Data Structures Cheat Sheet for Interviews
      • networking_cheatsheet
  • Tools
    • πŸ› οΈTools
      • VSCODE Cheat Sheet
      • Emmet
  • πŸ“ΌGuides-Tutorials
    • Tutorials
      • React.js
  • JavaScript Arrays
  • editorconfig
  • AWS CLI
  • ES6 EXPORTS
  • Flynn
  • Github
    • Github
      • Github Cheat Sheet
    • git log
    • GITHUB Cheat Sheet
      • An Executable Data Structures Cheat Sheet for Interviews
      • graphs_cheatsheet
  • General
    • General
  • πŸ‘¨β€πŸ’»πŸ‘¨πŸ’» πŸ‘¨πŸ’» πŸ’» Programming Languages
    • 🐍Python:
      • Python
        • What is Python
      • Regex In Python
    • HTML
  • EC2 API tools
    • MARKDOWN
    • πŸ§˜β™‚ PSQL
      • POSTGRES
      • postgreSQL_cheatsheet
  • ES6 IMPORTS
    • bash_cheatsheet
    • cleancode
    • πŸ”¨Bash
      • Bash Cheat Sheet
      • Learn Bash Scripting: Bash Scripting Cheatsheet
      • Curl
      • Bash Shortcuts Cheat Sheet
      • SSH Cheatsheet
      • Linux
    • CSS
      • CSS
        • CSS Grid
        • cssnext
        • CSS Cheat Sheet
        • CSS Flex Box
        • CSS tricks
        • CSS selectors
        • cssnext
        • CSS background
        • CSS animations
    • Typescript
  • Computer Science Concepts
    • An Executable Data Structures Cheat Sheet for Interviews
    • graphs_cheatsheet
    • networking_cheatsheet
    • Firebase
    • networking_cheatsheet
    • πŸ›Heroku Cheat Sheet
    • Binary Tree
  • πŸ“šDocs
    • Docs
      • editorconfig
      • EC2 API tools
      • Asynchronous JavaScript Cheat Sheet
      • CHEATSHEET (3)
      • js-model
      • Emmet
      • Binary Tree
      • Python
      • Contributor Covenant Code of Conduct
      • networking_cheatsheet
      • Common HTTP status codes Cheat Sheet
      • AWS CLI
      • Linux
      • networking_cheatsheet
      • React Patterns:
      • MDN Web Docs Glossary: Definitions of Web-related terms \| MDN
      • JavaScript Arrays
      • Linux
      • Javascript Python cheatsheet
      • Cheatsheet-v2
      • Binary Tree
      • Heroku Cheat Sheet
      • Asynchronous JavaScript Cheat Sheet
      • Cheatsheet Compilation
      • AWS CLI
      • EC2 API tools
      • Common HTTP status codes Cheat Sheet
      • Firebase
      • The Queue data structure
      • Cheat Sheet for Beginners: JavaScript Data Structures Methods
Powered by GitBook
On this page
  • Table of Contents
  • Prerequisites
  • Testing the Code
  • Linting the Code

Was this helpful?

Edit on GitHub
  1. πŸ‘¨πŸ’» πŸ‘¨πŸ’» πŸ’» Programming Languages
  2. Python:

Python

PreviousPython:NextWhat is Python

Last updated 3 years ago

Was this helpful?

Table of Contents

  1. Getting Started

    • What is Python

    • Python Syntax

    • Variables

  2. Operators

    • Arithmetic Operators (+, -, *, /, //, %, **)

    • Bitwise Operators (&, |, ^, >>, <<, ~)

    • Assignment Operators (=, +=, -=, /=, //= etc.)

    • Comparison Operator (==, !=, >, <, >=, <=)

    • Logical Operators (and, or, not)

    • Identity Operators (is, is not)

    • Membership Operators (in, not in)

  3. Data Types

    • Numbers (including booleans)

    • Strings and their methods

    • Lists and their methods (including list comprehensions)

    • Tuples

    • Sets and their methods

    • Dictionaries

    • Type Casting

  4. Control Flow

    • The if statement

    • The for statement (and range() function)

    • The while statement

    • The try statements

    • The break statement

    • The continue statement

  5. Functions

    • Function Definition (def and return statements)

    • Scopes of Variables Inside Functions (global and nonlocal statements)

    • Default Argument Values

    • Keyword Arguments

    • Arbitrary Argument Lists

    • Unpacking Argument Lists (* and ** statements)

    • Lambda Expressions (lambda statement)

    • Documentation Strings

    • Function Annotations

    • Function Decorators

  6. Classes

    • Class Definition (class statement)

    • Class Objects

    • Instance Objects

    • Method Objects

    • Class and Instance Variables

    • Inheritance

    • Multiple Inheritance

  7. Modules

    • Modules (import statement)

    • Packages

  8. Errors and Exceptions

    • Handling Exceptions (try statement)

    • Raising Exceptions (raise statement)

  9. Files

    • Reading and Writing (with statement)

    • Methods of File Objects

  10. Additions

    • The pass statement

    • Generators (yield statement)

  11. Brief Tour of the Standard Libraries

    • Serialization (json library)

    • File Wildcards (glob library)

    • String Pattern Matching (re library)

    • Mathematics (math, random, statistics libraries)

    • Dates and Times (datetime library)

    • Data Compression (zlib library)

  12. User input

    • Terminal input (input statement)

Prerequisites

Installing Python

Depending on your installation you might have access to Python3 interpreter either by running python or python3. The same goes for pip package manager - it may be accessible either by running pip or pip3.

You may check your Python version by running:

python --version

Note that in this repository whenever you see python it will be assumed that it is Python 3.

Installing dependencies

Install all dependencies that are required for the project by running:

pip install -r requirements.txt

Testing the Code

You may add new tests for yourself by adding files and functions with test_ prefix (i.e. test_topic.py with def test_sub_topic() function inside).

To run all the tests please execute the following command from the project root folder:

pytest

To run specific tests please execute:

pytest ./path/to/the/test_file.py

Linting the Code

PyLint

pylint ./src/

In case if linter will detect error (i.e. missing-docstring) you may want to read more about specific error by running:

pylint --help-msg=missing-docstring

Flake8

flake8 ./src

Or if you want to have more detailed output you may run:

flake8 ./src --statistics --show-source --count

Make sure that you have on your machine.

You might want to use standard Python library to create virtual environments and have Python, pip and all dependent packages to be installed and served from the local project directory to avoid messing with system wide packages and their versions.

Tests are made using framework.

Linting is done using and libraries.

To check if the code is written with respect to style guide please run:

To check if the code is written with respect to style guide please run:

πŸ‘¨β€πŸ’»
🐍
Python3 installed
venv
pytest
pylint
flake8
PEP 8
More about PyLint
PEP 8
141KB
learn-python-src.zip
archive