python

python

How to change the values of a dictionary in Python

How to change the values of a dictionary in Python. We will learn to use keys and the update method to change Python dictionary values with examples.

Read
python

How to remove items from a dictionary in Python

Learn how to remove items from a dictionary in Python. This post will show you how to remove single item, delete a dictionary and clear all items from a dictionary.

Read
python

3 ways in Python to find the middle n list elements

Learn to find the n middle list elements in Python in 3 different ways. We will learn how to do it by using a loop, by using list slicing and by using user input values in this post.

Read
python

2 ways in Python to convert temperature in Celsius to Fahrenheit

Python program to convert temperature in celsius to Fahrenheit with user input values. We will learn how to write this program by using a separate method and without using a separate method.

Read
python

4 different Python programs to check if a number is a perfect number

Python program to check if a number is a perfect number or not in 4 different ways. The program will take one number as input from the user and check if it is a perfect number or not.

Read
python

Python program to print the multiplication table of a specific number

Python program to print the multiplication table of a number in two different ways. We will learn how to use a for loop and how to use a while loop to print the multiplication table.

Read
python

3 ways in Python to calculate GCD or HCF of two numbers

Python program to calculate GCD or HCF of two user input numbers. Learn how to do it by using a for loop, by reverse looping and by Euclid's division algorithm.

Read
python

Python program to check if a number is a Niven or Harshad number

Python program to check if a number is a Niven or Harshad number or not. The program will take one number as input from the user and print if it is a Niven or Harshad number.

Read
python

Python example to print the function name as string with __name__ and __qualname__

Python program to get the function name as a string. We will learn how to use the __name__ and __qualname__ attributes to get the name of a function in this post with example.

Read
python

3 different Python programs to get a string after a substring

Python program to get a string after a specific substring. We will learn three different ways to get the string after a given substring of a string in Python.

Read