python

python

Python program to convert meter to yard

This tutorial will show you how to convert a distance of meter to yard. If you are getting the value in one unit, you need to convert it to a different unit if your program is working on a separate unit. This is a commonly faced problem. If you are using any third-party APIs and if that API returns data in meter, you need to convert it to yard if you are showing the information in yard to the user.

Read
python

Python program to remove one occurrence of a word in a list

In this tutorial, we will learn how to remove the kth occurrence of a word in a given list. The list is given. It contains words and most words are repeated. We will create one function to remove the kth occurrence of one word if it is available in the list. If it is not available, it will show one message.

Read
python

Python program to find the area and perimeter of a triangle

In this tutorial, I will show you how to find the area and perimeter of a triangle in Python. For calculating both area and perimeter, we need the values of the sides of the triangle. So, the program will take the sides as input from the user and calculate the values.

Read
python

Sort a python dictionary by values

Dictionary is used to store key-value pairs. We can sort the items in a dictionary based on the values. In this tutorial, I will show you how to sort a python dictionary based on its values.

Read
python

Python program to find the cube sum of first n numbers

This program will show you how to get the cube sum of first n natural numbers in python. The program will take the value of n as an input from the user, calculate the sum of cube and print it out.

Read
python

Find the product of all odd, even numbers in a python list

In this tutorial, we will learn how to find the product of all odd and even numbers in a list. The program will take the list values as input from the user and print out the product. With this program, you will learn how to use a for loop,if-else condition and how to take inputs in python.

Read
python

Python find the key of a dictionary with maximum value

In this tutorial, we will learn how to find the key of a dictionary with maximum value in python. We will learn different ways to solve this problem. In these examples, we will use one predefined dictionary.

Read
python

Python flatten a nested list or list of lists

Nested lists are lists holding other lists as its elements. These are also called lists of lists. If you want to flatten a nested list, you can easily do it by running a couple of for loops. In this tutorial, we will learn how to flat a nested list using a couple of different approaches.

Read
python

Python program to find all numbers in a string

In this tutorial, we will learn how to find out all numbers in a string using python. The program will take one string as an input from the user. It will find out all numbers in that string and print them on the console.

Read
python

Python program to check and create one directory

Python OS module provides different methods to perform different operating system tasks like create a directory, delete a directory, etc. In this post, we will learn how to check if a directory exists or not and to create one directory if it doesn't exist.

Read