Category: programs in python
Retrieve a module path in Python: 5 Methods
Now, you can use this ‘a_module’ inside your program but do you know where Python looks for modules or retrieve a module path? Let’s check….
Slicing in Python: 4 Important Things to Remember
This blog will discuss the principle of slicing in Python. Python has become one of the most popular languages in 2022 with the most job…
How to get a function name as a string in Python?
Today, we will see the two most used methods to get a function name as a string in Python. Using __name__ to get a function…
Access dictionary values in Python | dict[key] vs dict.get(key)
dict[key] and dict.get(key) are two ways to access dictionary values in Python. The difference is that dict.get(key) takes two arguments while dict[key] takes one argument…
Ternary operator in Python: 6 possible methods
There are many ways to make a ternary operator in Python but there exists a one-liner if-else statement that is usually called the ternary or…
Get the length of a list in Python
Lists in Python are one of the most commonly used built-in data structures. Many times we need to find the length of a list in…
Factorial Program in Python: Top 6 Methods
What is factorial? The factorial of a number(non-negative integers) is the product of all positive numbers that are less than or equal to the number…
![Access dictionary values in Python | dict[key] vs dict.get(key)](https://copyassignment.com/wp-content/uploads/2022/12/dictkey-vs-dict.getkey-480x360.jpg)