python

python

Python string center method explanation with example

center() is an inbuilt method defined in the python string. Using this method, we can centre align a string. By default, we can centre align a string with space on its side. Or we can give specific characters as the fill character.

Read
python

How to read a user input list in python

Sometimes we need to read a list of inputs from the user. For example, if our program needs a list of strings as an input from the user, we will have to ask the user to enter these values. We can get them one by one or all in one go. In this post, I will show you how to handle this situation in Python.

Read
python

Python String isspace() explanation with example

isspace() is used to check if a string contains all white space characters or not. If your program can't handle white spaces, this method really comes handy. For example, on your server, you can confirm a string before performing any operation on it.

Read
python

How to print keys and values of a python dictionary

Three different ways to print the key-value pairs of a Python dictionary. We will learn to do it by using a loop, using the items() method and iterating through the keys of the dictionary.

Read
python

Python example program to solve the quadratic equation

In this python programming tutorial, we will learn how to solve a quadratic equation. The user will enter the values of the equation, our program will solve it and print out the result. The quadratic equation is defined as below :where, a,b, and c are real numbers and 'a' is not equal to zero. To find out the value of x, we have one equation called quadratic equation which is defined as below..

Read
python

Two ways to find the set difference in Python

In this python programming tutorial, we will learn how to find the difference between two sets. The difference between set A and set B is a set that contains only the elements from set A those are not in set B. In this example, we will take the inputs from the user for both sets. The program will calculate the difference and print it out.

Read
python

Python program to convert kilometers to miles

In this python programming tutorial, we will learn how to convert a kilometer value to miles. The program will take the kilometer input from the user, convert it and print out the result.

Read
python

Python program to find out the perimeter of a triangle

In this python programming tutorial, we will learn how to find out the perimeter of a triangle using user-provided values. The program will take the inputs from the user and print out the result.

Read
python

Python program to find out the largest divisor of a number in 3 ways

This post will show you three different ways to find the largest divisor of a number in Python. We will learn how to use a for loop or how to use the next() function to calculate the largest divisor with examples.

Read
python

Python program to find factors of a number

Python program to find the factors of a number. The program will take one number as the input from user and print out the factors for that number.

Read