Python Program to Compute a Polynomial Equation

This is a Python Program to compute a polynomial equation given that the coefficients of the polynomial are stored in the list. Problem Description The program takes the coefficients of the polynomial equation and the value of x and gives the value of the polynomial. Problem Solution 1. Import the math module. 2. Take in … Read more

advertisement

Python Program to Check If Two Numbers are Amicable Numbers or Not

This is a Python Program to check if two numbers are amicable numbers. Problem Description The program takes two numbers and checks if they are amicable numbers. Problem Solution 1. Take in both the integers and store it in separate variables. 2. Find the sum of the proper divisors of both the numbers. 3. Check … Read more

advertisement

Python Program to Find the Area of a Triangle

This is a Python Program to find the area of a triangle given all three sides. Problem Description The program takes three sides of a triangle and prints the area formed by all three sides. Problem Solution 1. Take in all the three sides of the triangle and store it in three separate variables. 2. … Read more

advertisement

Python Program to Find the Gravitational Force between Two Objects

This is a Python Program to find the gravitational force acting between two objects. Problem Description The program takes the masses of two objects and the distance between them to determine the gravitational force acting between the objects. Problem Solution 1. Take in both the masses and the distance between the masses and store it … Read more

advertisement

Python Program to Check if a Number is a Strong Number

This is a Python Program to check if a number is a strong number. Problem Description The program takes a number and checks if it is a strong number. Problem Solution 1. Take in an integer and store it in a variable. 2. Using two while loops, find the factorial of each of the digits … Read more

advertisement

Python Program to Form an Integer that has Number of Digits at 10’s Place & LSD at 1’s Place

This is a Python Program to form an integer that has the number of digits at the ten’s place and the least significant digit in the one’s place. Problem Description The program takes an integer and forms a new integer which has the number of digits at the ten’s place and the least significant digit … Read more

advertisement

Python Program to Check Armstrong Number

Armstrong Number in Python: Armstrong Number is an integer such that the sum of the cubes of its digits is equal to the number itself. Armstrong numbers are 0, 1, 153, 370, 371, 407, etc. Formula to calculate Armstrong Number: wxyz = pow(w,n) + pow(x,n) + pow(y,n) + pow(z,n) Example 1: Let’s look at 153 … Read more

advertisement

Python Program to Find the LCM of Two Numbers

This is a Python Program to find the LCM of two numbers. Problem Description The program takes two numbers and prints the LCM of two numbers. Problem Solution 1. Take in both the integers and store it in separate variables. 2. Find which of the integer among the two is smaller and store it in … Read more

advertisement

GCD of Two Numbers in Python

GCD stands for Greatest Common Divisor. In Python, the GCD is a mathematical function that returns the largest positive integer that divides two or more numbers without leaving a remainder. It can be calculated using the math module or by implementing custom algorithms such as Euclidean algorithm or recursive approach. Example: GCD(15,5) = 5, GCD(105,222) … Read more

advertisement

Python Program to Find the Prime Factors of a Number

This is a Python Program to compute prime factors of an integer. Problem Description The program takes a number and computes the prime factors of the integer. Problem Solution 1. Take the value of the integer and store in a variable. 2. Using a while loop, first obtain the factors of the number. 3. Using … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.