Find The Full Path of The Python Interpreter

[toc] Introduction Problem Statement: How to find the full path of the currently running Python interpreter? There are different ways to find the full path of Python interpreters. But first, let’s get the basics out of our way before we unearth the solution to our problem statement. So, what’s a Python Interpreter? This might be … Read more

What is an Array in Computer Science?

In computer science, an array data structure consists of a collection of elements—usually of the same type such as integer or string. Each element is identified by an array index. Arrays are designed to allow extremely efficient access of individual elements by index: runtime complexity is constant with growing array size! The reason is that … Read more

Python Comments — 2-Minute Guide with Exercise

Wouldn’t reading code be much easier if the author constantly shared their thoughts with you? Commenting is good practice in Python because it helps others (and your future self) understanding your code much better. Writing commented code makes you more productive in the long term! There are two types of comments: one-line comments and multi-line … Read more

Python raw_input() vs input()

Summary: The key differences between raw_input() and input() functions are the following: raw_input() can be used only in Python 2.x and is obsolete in Python 3.x and above and has been renamed input() In Python 2.x, raw_input() returns a string whereas input() returns result of an evaluation. While in Python 3.x input() returns a string … Read more

How To Resolve UnboundLocalError On Local Variable When Reassigned After The First Use?

Summary: To resolve an UnboundLocalError when the local variable is reassigned after the first use, you can either use the global keyword or the nonlocal keyword. The global keyword allows you to modify the values of a global variable from within a function’s local scope while the nonlocal keyword provides similar functionality in case of … Read more