Python Basics Summary
Summary of Python Basic Fundamentals
This page covers all main points throughout the Python basic fundamentals.
Theory of Python (more)
Python is a programming language, which have an easy-to-learn and English-like syntax. It is interpreted, high-level, and dynamically typed. The programming language also carries object-oriented, procedural, and functional programming paradigms.
Its uses surround a variety of applications, such as:
- scientific and numeric computing
- web and internet development
- business applications
- software development
- desktop GUIS and mobile apps
- education
Python Basics (more)
- syntax is vitally important
- “print()” statement returns a message
- two types of comments (“#” for single line or triple quotes for multiline)
- variables store data values
- modules, packages, and libraries are collections of code
- “as” renames modules, packages, and libraries
- PIP is a package management system
Python Data Types (more)
- string refers to text
- numbers are integers, floats, and complex
- lists use square brackets “[]”
- tuples use round brackets “()”
- sets use curly brackets “{}”
- dictionaries use curly brackets “{}”
- boolean refers to two choices (e.g. True or False)
- nonetype refers to no value
- binary manipulates binary data
- “type()” checks the data type
Python Conditions (more)
- Operators (such as =, +, *, etc.) interact with variables and values
- “if” statements execute when a condition is True
- else statement executes anything that “if” does not
- “elif” statements add more conditions
Python Loops (more)
- “for” loops iterate over sequences
- “while” loops execute repeatedly until a condition is met
Python Input (more)
- “input()” allows users to interact with the program
Python Functions (more)
- functions are blocks of code (keyword “def”)
- parameters and arguments pass informational flow
Python Classes (more)
- classes encompass functions, variables and data into one
- “__init__” built-in function assigns values to properties
- “self” refers to the current instance of the class
Python Files (more)
- “open()” opens a file
- “close()” closes a file
- “r” refers to reading mode
- “w” refers to writing mode
- “a” refers to appending mode
- “x” refers to creating mode
Python Errors (more)
- two types of errors (syntax and exceptions)
- “try/except” allow developers to test code and handle errors.