Category: Python Programs

python tutorials and learn python

Created with Sketch.

Python Program to Find LCM

Python Program to Find LCM LCM: Least Common Multiple/ Lowest Common Multiple LCM stands for Least Common Multiple. It is a concept of arithmetic and number system. The LCM of two integers a and b is denoted by LCM (a,b). It is the smallest positive integer that is divisible by both “a” and “b”. For…
Read more

Python Program to Find the Sum of Natural Numbers

Python Program to Find the Sum of Natural Numbers Natural numbers: As the name specifies, a natural number is the number that occurs commonly and obviously in the nature. It is a whole, non-negative number. Some mathematicians think that a natural number must contain 0 and some don’t believe this theory. So, a list of…
Read more

Python Program to Find Armstrong Number between an Interval

Python Program to Find Armstrong Number between an Interval We have already read the concept of Armstrong numbers in the previous program. Here, we print the Armstrong numbers within a specific given interval. See this example: lower = int(input(“Enter lower range: “)) upper = int(input(“Enter upper range: “)) for num in range(lower,upper + 1):    sum = 0    temp = num    while temp > 0:        digit = temp % 10        sum += digit ** 3        temp //= 10        if num == sum:             print(num) lower = int(input(“Enter lower range: “))<br /> upper…
Read more

Python Program to Check Armstrong Number

Python Program to Check Armstrong Number Armstrong number: A number is called Armstrong number if it is equal to the sum of the cubes of its own digits. For example: 153 is an Armstrong number since 153 = 1*1*1 + 5*5*5 + 3*3*3. The Armstrong number is also known as narcissistic number. See this example:…
Read more

Python Program to Print all Prime Numbers between an Interval

Python Program to Print all Prime Numbers between an Interval We have already read the concept of prime numbers in the previous program. Here, we are going to print the prime numbers between given interval. See this example: #Take the input from the user:  lower = int(input(“Enter lower range: “)) upper = int(input(“Enter upper range: “)) for num in range(lower,upper + 1):    if num > 1:        for i in range(2,num):            if (num % i) == 0:                break        else:            print(num) #Take the input from the user:<br />…
Read more

Python Program to Check Prime Number

Python Program to Check Prime Number Prime numbers: A prime number is a natural number greater than 1 and having no positive divisor other than 1 and itself. For example: 3, 7, 11 etc are prime numbers. Composite number: Other natural numbers that are not prime numbers are called composite numbers. For example: 4, 6,…
Read more