Blog

python tutorials and learn python

Created with Sketch.

Python Concurrency

Python Concurrency In this section, you’ll learn about Python concurrency including multithreading, multiprocessing, and asynchronous programming from scratch. What you’ll learn: Build high-performance & responsive Python applications using concurrency techniques. Develop multithreaded applications using multithreading. Develop a program that processes tasks in parallel. Understand the single-threaded concurrency model. Section 1. Multithreading In this section, you’ll…
Read more

Python Context Managers

Python Context Managers Summary: in this tutorial, you’ll learn about Python context managers and how to use them effectively Introduction to Python context managers A context manager is an object that defines a runtime context executing within the with statement. Let’s start with a simple example to understand the context manager concept. Suppose that you…
Read more

Python Generator Expressions

Python Generator Expressions Summary: in this tutorial, you’ll learn about the Python generator expression to create a generator object. Introduction to generator expressions A generator expression is an expression that returns a generator object. Basically, a generator function is a function that contains a yield statement and returns a generator object. For example, the following…
Read more

Python Generators

Python Generators Summary: in this tutorial, you’ll learn about Python generators and how to use generators to create iterators Introduction to Python generators Typically, Python executes a regular function from top to bottom based on the run-to-completion model. It means that Python cannot pause a regular function midway and then resumes the function after that.…
Read more

Python iter

Python iter Summary: in this tutorial, you’ll learn how to use the Python iter() built-in function effectively. Introduction to the Python iter function The iter() function returns an iterator of a given object: iter(object) Code language: Python (python) The iter() function requires an argument that can be an iterable or a sequence. In general, the…
Read more

Python Iterator vs Iterable

Python Iterator vs Iterable Summary: in this tutorial, you’ll learn about Python iterator and iterable and their differences. Iterators An iterator is an object that implements the iterator protocol. In other words, an iterator is an object that implements the following methods: __iter__ returns the iterator object itself. __next__ returns the next element. Once you…
Read more

Python Iterators

Python Iterators Summary: in this tutorial, you’ll learn about Python iterator and how to define a custom iterator using the iterator protocol. What is a Python iterator? An iterator is an object that implements: __iter__ method that returns the object itself. __next__ method that returns the next item. If all the items have been returned,…
Read more

Python Fibonacci Sequence

Python Fibonacci Sequence Summary: in this tutorial, you’ll learn how to define a custom Sequence type in Python and how to implement the Fibonacci sequence using a custom Sequence type. Introduction to the custom Sequence type in Python Sometimes, it’s useful to implement a custom sequence type that has functions similar to the built-in sequence…
Read more

Python Slicing in Depth

Python Slicing in Depth Summary: in this tutorial, you’ll learn about Python slicing and how to use it to extract data from and assign data to a sequence. Python slicing review So far you’ve learned about slicing such as list slicing. Technically, slicing relies on indexing. Therefore, slicing only works with sequence types. For mutable…
Read more

Python Tuple vs. List

Python Tuple vs. List Summary: in this tutorial, you’ll learn the difference between tuple and list. Both tuple and list are sequence types. However, they have some main differences. 1) A tuple is immutable while a list is mutable The following example defines a list and modifies the first element: fruits = [‘apple’, ‘orange’, ‘banana’]…
Read more