Blog

python tutorials and learn python

Created with Sketch.

Python Program to Add Two Matrices

Python Program to Add Two Matrices What is Matrix? In mathematics, matrix is a rectangular array of numbers, symbols or expressions arranged in the form of rows and columns. For example: if you take a matrix A which is a 2×3 matrix then it can be shown like this: 2       3          5 8       12        7 2 3 5<br />…
Read more

Python Program to Find Factorial of Number Using Recursion

Python Program to Find Factorial of Number Using Recursion Factorial: Factorial of a number specifies a product of all integers from 1 to that number. It is defined by the symbol explanation mark (!). For example: The factorial of 5 is denoted as 5! = 1*2*3*4*5 = 120. See this example: def recur_factorial(n):    if n == 1:        return n    else:…
Read more

Python Program to Display Fibonacci Sequence Using Recursion

Python Program to Display Fibonacci Sequence Using Recursion Fibonacci sequence: A Fibonacci sequence is a sequence of integers which first two terms are 0 and 1 and all other terms of the sequence are obtained by adding their preceding two numbers. For example: 0, 1, 1, 2, 3, 5, 8, 13 and so on… See…
Read more

Python Function to Display Calendar

Python Function to Display Calendar In Python, we can display the calendar of any month of any year by importing the calendar module. See this example: # First import the calendar module import calendar # ask of month and year yy = int(input(“Enter year: “)) mm = int(input(“Enter month: “)) # display the calendar print(calendar.month(yy,mm)) # First import the calendar module<br /> import calendar<br /> # ask of month and year<br /> yy = int(input(“Enter year: “))<br…
Read more

Python Program to Make a Simple Calculator

Python Program to Make a Simple Calculator In Python, you can create a simple calculator, displaying the different arithmetical operations i.e. addition, subtraction, multiplication and division. The following program is intended to write a simple calculator in Python: See this example: # define functions def add(x, y):    “””This function adds two numbers””    return x + y def subtract(x, y):    “””This function subtracts two numbers“””    return x – y def multiply(x, y):    “””This function multiplies two numbers“””    return x * y def divide(x, y):    “””This function divides two numbers”””    return x / y # take input from the user…
Read more

Python Program To Find ASCII value of a character

Python Program To Find ASCII value of a character ASCII: ASCII is an acronym stands for American Standard Code for Information Interchange. In ASCII, a specific numerical value is given to different characters and symbols, for computers to store and manipulate. It is case sensitive. Same character, having different format (upper case and lower case)…
Read more

Python Program to Convert Decimal to Binary, Octal and Hexadecimal

Python Program to Convert Decimal to Binary, Octal and Hexadecimal Decimal System: The most widely used number system is decimal system. This system is base 10 number system. In this system, ten numbers (0-9) are used to represent a number. Binary System: Binary system is base 2 number system. Binary system is used because computers…
Read more

Python Program to Find HCF

Python Program: Finding Highest Common Factor (HCF) In this blog post, we will explore the concept of the Highest Common Factor (HCF) and provide a detailed Python program to find the HCF of two numbers. The article will cover the algorithm behind the HCF calculation, present the Python code for implementation, and include examples with…
Read more

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