python

python

How to remove the first occurrence of an item in a list in Python

Python program to remove the first occurrence of an item from a list. We will learn how to use the remove() method, pop() method and del operator with example for each.

Read
python

Python id() function explanation with examples

This post will show you how id() function works in Python. The id() function is used to get the identity of an object. Learn how this function works with different examples.

Read
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