This program demonstrates how you can convert kilometers to miles in Python. The conversion of Kilometer to miles is a kind of a simple calculation. The formula to calculate the mile from kilometers is below. 1 Mile = 1.60934 Kilometers. All that we need to do is do multiple the input (kilometers) by 0.621371 to […]

## Python Program to Generate Random Number

This program demonstrates how to generate random number in python using the randint method. How to generate random number in Python? Inorder to generate random number in Python, you will need to use the randint() function which is defined in the random module() in python. Output 7 Everytime when the randint function is called , […]

## Python Program to Swap Two Variables

In this Python program , you will learn how to swap two variables easily with 2 options. Swap two variable using a temporary variable in python. Swap two variable without using temporary variable in python. How to Swap two variables in Python without using Temporary Variable? Output a : 3b : 8 How to Swap […]

## Python Program to Compute Quadratic Equation

This Python program demonstrates how you can compute Quadratic Equation using a Python program when the co-efficients are defined. The Formula for the Quadratic Equation in Standard Form is ax2 + bx + c = 0 a,b,c are real numbers and A is not equal to zero. How to Compute Quadratic Equation in Python ? […]

## Python Program to Calculate the Area of Triangle

This Python program shows how you can calculate the area of a triangle in python and display it using the python’s print method. How to Calculate the area if a triangle in Python? Assume that you have three variables side1,side2 and side3 which refers to the three sides of a triangle. The area of the […]

## Python Program to Find the Square Root of Number

This python program will demonstrate how you can find the square root of a number using exponent operator python. Basic Program to find Square Root for Positive Number in Python Output The square root of 4.000 is 2.000 In this python program , we use the exponent operator ** to find the square root of […]

## Python Program to Add Two Numbers

This Python program demonstrates how you can add two numbers in python and display it using the print() function. Python Program to Add Two Numbers Python program to add two numbers Output The sum of 898.2 and 111.6 is 1009.8000000000001 In this program , the variables number1 and number2 contains the numeric values that needs […]

## Python Program to Display Hello world

This is a simple program written in Python language that displays Hello World. The programs demonstrates how the Python code looks like and is a beginner program. Python Program to Display Hello world Output This program uses the python’s built-in print function to display the string Hello, world in the screen. The strings in python […]

## Python – How do list all files of a directory?

In Python ,you can list all files of a directory using the os.listdir(). How do list all files of a directory in Python? You can use the os.listdir() in pythpn which will list all the files that is in the directory includes files and directories. Incase you want just the files , you can filter […]

## Python Program to add two integers

Problem Write a program in Python to add two integers and display the result on the screen. Python Program to add two integers Output Enter first number: 1 Enter second number: 2 1 + 2 = 3.0