Tag: python examples

Python Program to Check if a Number is Odd or Even

In this Python program, let’s learn how you can check a given number if it is odd or even. How to Check if a Number is Odd or Even in Python? A number is a even number if it is perfectly divisible by 2 i.e if the remainder is 0. In Python, you can use the modulus operator (%) to find the remainder. If the…

Python Program to Find the Factorial of a Number

In this Python program, you will learn how to find the factorial of a number and display it using the print statement. Before we start coding, its important to understand what is a factorial. The factorial of a number is the product io all the number from 1 until that number. To give you an example , lets say you want to find the factorial…

Python Program to Check If a Given Year is Leap Year

This Python program will demonstrate how you can check to see if a given year is a leap year or not. A leap year is a year that is exactly divisible by 4 except for the years that end with 00. For the years that ends with 00 , it is considered to be a leap year if it is divisible by 400. How to…

Python Program to Check Prime Number

This Python program demonstrates how you can check if a given number is a prime number or not. A number is a prime number if the following confitions are satisfied It is a Positive Number It is Greater than 1. Has no other factors except 1 and the number itself. Some of the examples of a prime number are 2,3 etc. How to Check if…

Python Program to Print Fibonacci Series

In this Python program, you will learn how to generate and print Fibonacci series using loops and conditional statements. What is a Fibonacci Sequence ? A Fibonacci sequence is an sequence of integers where the value of the sequence is determined by adding the preceding two values. The first two values in the sequence is 0 and 1. Then comes Next one with (N-1) +…

Python Program to Compute Quadratic Equation

This Python program demonstrates how you can compute Quadratic Equation using a Python program when the co-efficients are defined. The Formula for the Quadratic Equation in Standard Form is ax2 + bx + c = 0 a,b,c are real numbers and A is not equal to zero. How to Compute Quadratic Equation in Python ? Output (-1.25-1.5612494995995996j) and (-1.25+1.5612494995995996j) Following are the steps that we…