Blog

python tutorials and learn python

Created with Sketch.

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

Python program that checks if a given number is odd or even:

Python program that checks if a given number is odd or even: 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 remainder of dividing the number by 2 is equal to 0. If…
Read more

Python program that checks if a given number is positive, negative, or zero:

Python program that checks if a given number is positive, negative, or zero: 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 the value of the number. If the number is greater than 0, it…
Read more

Python program that displays a calendar for a given month and year:

Python program that displays a calendar for a given month and year: The program prompts the user to enter the year and month using the input() function, and stores the values in the variables “year” and “month”. It then imports the calendar module and uses the month() function to display the calendar for the given…
Read more

Python program that converts Celsius to Fahrenheit:

Python program that converts Celsius to Fahrenheit: The program prompts the user to enter the temperature in Celsius using the input() function, and stores the value in the variable “celsius”. It then uses the formula (celsius * 9/5) + 32 to convert Celsius to Fahrenheit. And then it prints the result using the print() function.…
Read more