Category: Other

python tutorials and learn python

Created with Sketch.

Python program that finds the least common multiple (LCM) of two given numbers:

Python program that finds the least common multiple (LCM) of two given numbers: The program prompts the user to enter two numbers using the input() function, and stores the values in the variables “num1” and “num2”. It then uses an if-else statement to find the maximum number out of the two numbers. Then it uses…
Read more

Python program that finds the sum of natural numbers up to a given number:

Python program that finds the sum of natural numbers up to a given number: The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses an if statement to check if the number is valid, which is a positive integer greater than…
Read more

Python program that finds all Armstrong numbers in a given range:

Python program that finds all Armstrong numbers in a given range: The program prompts the user to enter the start and end of the range using the input() function, and stores the values in the variables “start” and “end”. It then uses a for loop to iterate through the range of numbers between start and…
Read more

Python program that checks if a given number is an Armstrong number:

Python program that checks if a given number is an Armstrong number: The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses a while loop to check if the number is an Armstrong number. An Armstrong number is a number that…
Read more

Python program that prints the Fibonacci sequence of a given number of terms:

Python program that prints the Fibonacci sequence of a given number of terms: The program prompts the user to enter the number of terms using the input() function, and stores the value in the variable “terms”. It then uses an if-elif-else statement to check if the number of terms is valid, then initializes the first…
Read more

Python program that displays the multiplication table of a given number:

Python program that displays the multiplication table of a given number:   The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses a for loop to iterate through the range of numbers from 1 to 11 and for each number, it…
Read more

Python program that finds the factorial of a given number:

Python program that finds the factorial of a given number: The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses an if-elif-else statement to check if the number is less than 0, equal to 0 or greater than 0. If the…
Read more

Python program that prints all prime numbers in a given range:

Python program that prints all prime numbers in a given range: The program prompts the user to enter the start and end of the range using the input() function, and stores the values in the variables “start” and “end”. It then uses a for loop to iterate through the range of numbers between start and…
Read more

Python program that checks if a given number is a prime number:

Python program that checks if a given number is a prime number: The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses an if-else statement to check if the number is greater than 1. If the number is greater than 1,…
Read more

Python program that checks if a given year is a leap year:

Python program that checks if a given year is a leap year: The program prompts the user to enter a year using the input() function, and stores the value in the variable “year”. It then uses an if-else statement to check if the year is a leap year. A leap year is a year that…
Read more