Month: June 2021

How to Get the Full Path of the Current File Directory in Python?

Knowing where you are is important, whether you are in the outdoors, stumbling to the toilet in the middle of the night, or simply programming. Dealing with your midnight confusing or outdoors route-finding skills are a little more complicated, but fortunately, it is pretty easy to figure out your current path in Python. ๐Ÿ Method …

How to Get the Full Path of the Current File Directory in Python? Read More »

[Interview Question] Reverse A Linked List

๐Ÿ—๏ธ Company Tags: As reported by numerous programmers across the globe, this question has been asked in coding interviews/rounds by companies like- Amazon Accolite Adobe Cisco Cognizant Goldman Sachs VMWare So, if you are preparing for your upcoming coding interview, then you might well come across this question in your coding round. Can you solve …

[Interview Question] Reverse A Linked List Read More »

Reverse A Linked List In Python

#Approach 1: Iterative Approach to Reverse Linked List Test Cases: # Example 1 linked_list = Solution() linked_list.push(5) linked_list.push(4) linked_list.push(3) linked_list.push(2) linked_list.push(1) Output: Given linked list 1 2 3 4 5 Reversed linked list 5 4 3 2 1 # Example 2 linked_list = Solution() linked_list.push(5) linked_list.push(4) linked_list.push(3) linked_list.push(2) linked_list.push(1) Output: Given linked list 1 2 …

Reverse A Linked List In Python Read More »

[Solved] TypeError: method() takes 1 positional argument but 2 were given

From teaching hundreds of thousands of students Python, I found this error to be a classic. I think understanding classes is hard enough, but many coders who’ve just started to learn about Python are rightly confused ๐Ÿ˜– about the TypeError that complains about too few positional arguments. Let’s resolve this confusion once and for all, …

[Solved] TypeError: method() takes 1 positional argument but 2 were given Read More »

How to Open Python .py Files in IDLE with a Doubleclick?

I love tweaking my coding workflow. Small improvements accumulate over time and can lead to a massive productivity increase. Today, I caught myself being annoyed that I always needed to spend three clicks or so just to open a Python file in IDLE, the default Python editor on Windows. Time to change that! Do you …

How to Open Python .py Files in IDLE with a Doubleclick? Read More »

How to Find Path Where Python is Installed on Windows?

Windows normally installs Python on one of the two locations: C:\Python39 C:\Users\YourUser\AppData\Local\Programs\Python\Python39 For me, it’s the latter. For you, it may be different—this article shows you how to check for yourself! ๐Ÿ™‚ For your convenience, I’ve made a short gif that shows how I rushed through the code on my Windows machine: Before you start, …

How to Find Path Where Python is Installed on Windows? Read More »

Python Method Resolution Order (MRO)

Today we’re going to look at the Python Method Resolution Order or MRO for short. If you’ve been following the tutorials on Python classes and inheritance, and you’ve been practicing in code, you’ll understand that once the hierarchy of classes moves into multiple inheritances, you may return strange results or end up with incomprehensible errors. …

Python Method Resolution Order (MRO) Read More »