186 Topics
Getting started with Python Language Introduction Topic
Incompatibilities moving from Python 2 to Python 3 All Versions
Unlike most languages, Python supports two major versions. Since 2008 when Python 3 was released, many have made the transition, while many have not. In order to understand both, this section covers the important differences between Python 2 and Python 3.
Comprehensions All Versions
List comprehensions in Python are concise, syntactic constructs. They can be utilized to generate lists from other lists by applying functions to each element in the list. The following section explains and demonstrates the use of these expressions.
List Comprehensions All Versions
A list comprehension is a syntactical tool for creating lists in a natural and concise way, as illustrated in the following code to make a list of squares of the numbers 1 to 10: [i ** 2 for i in range(1,11)] The dummy i from an existing list range is used to make...
Common Pitfalls All Versions
Python is a language meant to be clear and readable without any ambiguities and unexpected behaviors. Unfortunately, these goals are not achievable in all cases, and that is why Python does have a few corner cases where it might do something different than what you...
Generators All Versions
Classes All Versions
Python offers itself not only as a popular scripting language, but also supports the object-oriented programming paradigm. Classes describe data and provide methods to manipulate that data, all encompassed under a single object. Furthermore, classes allow for...
String Formatting All Versions
When storing and transforming data for humans to see, string formatting can become very important. Python offers a wide variety of string formatting methods which are outlined in this topic.
Functions All Versions
Functions in Python provide organized, reusable code to preform a set of actions. Functions simplify the coding process, prevent redundant logic, and make code easier to follow. This topic describes the declaration and utilization of functions in Python.
String Methods All Versions
Decorators Python 2.x2.4–2.7Python 3.x3.0–3.6
Decorator functions are software design patterns. They dynamically alter the functionality of a function, method, or class without having to directly use subclasses or change the source code of the decorated function. When used correctly, decorators can become...
List All Versions
Context Managers (“with” Statement) Python 2.x2.5–2.7Python 3.x3.0–3.6
While Python's context managers are widely used, few understand the purpose behind their use. These statements, commonly used with reading and writing files, assist the application in conserving system memory and improve resource management by ensuring specific...
Loops All Versions
As one of the most basic functions in programming, loops are an important piece to nearly every programming language. Loops enable developers to set certain portions of their code to repeat through a number of loops which are referred to as iterations. This topic...
Regular Expressions (Regex) All Versions
Importing modules All Versions
Virtual environments All Versions
A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global...
Simple Mathematical Operators All Versions
Python does common mathematical operators on its own, including integer and float division, multiplication, exponentiation, addition, and subtraction. The math module (included in all standard Python versions) offers expanded functionality like trigonometric...
Map Function All Versions
Bitwise Operators All Versions
Bitwise operations alter binary strings at the bit level. These operations are incredibly basic and are directly supported by the processor. These few operations are necessary in working with device drivers, low-level graphics, cryptography, and network...
Introduction Topic
Getting started with Python Language- Getting Started
- Creating variables and assigning values
- Block Indentation
- Datatypes
- IDLE - Python GUI
- Collection Types
- User Input
- Built in Modules and Functions
- Creating a module
- String function - str() and repr()
- Installing external modules using pip
- Installation of Python 2.7.x and 3.x
- Help Utility