Iterator | How To Build A Basic Iterator?

In this post, we will learn How to build a basic iterator in Python which we can perform using two of the given functions are __iter__ and __next__ which is explained here in detail. Iterator As we know that it is an object which could be iterated upon and here we have given an example … Read more

How to detect key presses?

In this post, we will learn How to detect Key presses in Python which we can get to know using the module Keyboard which has the power to provide a cross platform for detecting the keys we press is being detected by python. Pressed Key Here we have given an example to implement the same … Read more

How do I execute a string containing Python code in Python?

In this post, we will learn How to execute a String containing Python code in Python which we can perform using exec() which it takes the String containing python code as the input and executes as if it is simple and normal and that we have nothing special in it. String Containing Here we have … Read more

Python | Why Do People Write usr/bin/env Python On The First Line Of Python Script?

In this post, we will learn Why do people write #!/usr/bin/env python on the first line of a Python script where it is a shebang or hashbang which has a very specific use for specifying the interpreter that should be used for running the scrip. First Line(usr/bin/env) In Python Script In Python script we write … Read more

Reverse And Invert A Dictionary Mapping In Python

In this post, we will learn about Reverse and inverted dictionary mapping, and to do so we can create a new dictionary in which the keys and values are swapped for the same, we have given an example below. Reverse And Inverting a Dictionary Although there are different ways we can reverse the dictionary as … Read more

Cartesian Product Of x And y Array Points Into single Array Of 2D Points

In this post, we will learn the Cartesian product of x and y array points into a single array of 2D points which we can perform using the meshgrid() function of the numpy module and the example of the same we have given below where we can easily find how we can use and implement … Read more

GIL | What Is The Global Interpreter Lock (GIL) In CPython?

In this post, we will learn What is the global interpreter lock (GIL) in CPython As It is a mechanism which is when we use Cpython implementations where it is a mutex which simply means mutual exclusion that has a task to protect the access of python objects and to also used for protecting a … Read more

pip | Dealing With Multiple Python Versions And pip?

In this post, we will learn about Dealing with multiple Python versions and pip. We use pip to manage the modules of python as to install new python modules we use pip and dealing with different versions of python may create some challenges in pip so there are a number of things we need to … Read more

Difference Between Shallow Copy, Deep Copy And Normal Assignment Operation?

In this post, we will learn What is the difference between shallow copy, deep copy, and normal assignment operation where there are three different ways to make copies of the objects and here we will discuss the differences between all of them. Object Copies There are different ways where we can make copies of Objects … Read more

Why Do Lists Compare As Greater Than Numbers, And Tuples Greater Than Lists?

In this post, we will learn Why do Lists compare as greater than numbers, and tuples greater than lists and where to make comparisons between two or more different types of data types in python it is governed by a set of rules that we need to follow those rules to compare them and here … Read more

%d bloggers like this: