Python Program to Find the Union of two Lists

Here we will write a program in Python to find union of two lists. We will write a user defined function to enter the lists and will display the union as output. Step-wise Solution: 1. Define a function which accepts two lists and returns the union of them. 2. Declare two empty lists and initialise … Read more

Python Program to Reverse a number

Here we will write a program in Python to Reverse a number using while loop. Lets start with the steps: Step-wise Solution: 1. Take the value of the integer and store in a variable. 2. Using a while loop, get each digit of the number and store the reversed number in another variable. 3. Print … Read more

Python Program to Make a Simple Calculator

Here we will write a program in Python to make a Simple Calculator which will implement addition, subtraction, multiplication and division depending upon the input from user. Lets see how: In this program, we ask the user to choose the desired operation. Options 1, 2, 3 and 4 are valid. Two numbers are taken and … Read more

Python Program to Find the Largest Among Three Numbers

Here we will write a program in Python to find the largest among three numbers using if-else. In the program below, the three numbers are stored in num1, num2 and num3 respectively. I’ve used the if…elif…else ladder to find the largest among the three numbers. Python Program to Find the Largest Among Three Numbers: # Python program to find the largest number … Read more

Python Program to Calculate Area of Triangle

Here we will write a program in Python to calculate Area of Triangle. To find the area of triangle we need the sides of the triangle, if this program will only work if we have sides of triangle. So let’s see how to calculate area of triangle: If a, b and c are three sides of a triangle. Then using … Read more