## Find factorial of a number in python : Python tutorial 25

Find factorial of a number using for loop , while loop and recursion in python : What is factorial : Factorial of a number is the multiplication of all the numbers from 1 to that number e.g. factorial of 3 is 1 * 2 * 3 i.e. 6 . To find factorial, we can either […]

## Python class and objects : Python tutorial 24

Python classes and objects : Python is a “object oriented” programming language. In simple words, classes are templates for the objects , and objects are collection of variables and functions. Defining classes in python : Class definition looks like : class ClassName : statements Similar to functions, class definitions should execute at first before running. […]

## Python Exception : Python Tutorial 23

Python Exception : What is an Exception : Exceptions are errors that raised during execution time. That means your statement is correct but during execution time , it was trying to run a statement that cannot be done . Let’s take an example on a python exception : for i in range(5,-1,-1): print 5/i Output […]

## Python program to check palindrome using one if-else : Python tutorial 22

Python Program to check if a string is palindrome or not : What is a palindrome String ? A String which is same in both direction i.e. if we reverse the String, it will remain same. e.g. “123454321” is a palindrome String but “12345” is not. To check if a String is palindrome or not, […]

## Python File operations : Python Tutorial 21

Python File operations : Open, Close, Read , Write and Append to a file in Python : Python has functions and methods to manipulate files . No external library is required for doing file operations in python. In this tutorial, we will learn different python file operations like reading the content of a file, writing […]

## Python Program to find the factorial of a Number : Python Tutorial 20

Python program to find the factorial of a number : The factorial of a number is the product of all the numbers from 1 to that number. e.g. factorial of 5 is 1 * 2 * 3 * 4 * 5 i.e. 120 . Factorial is denoted by “!” : 5 factorial is denoted by 5! […]

## Python Package : Python Tutorial 19

Python Package : What is a python package ? In simple words , python packages are directories containing python files. We love to arrange files in our computer in different directories, like all movies in a “movie” folder or all songs in a “songs” folder etc. So, what is the use of using packages ? […]

## Python Module : Python tutorial 18

Python Module : A python module is simply a python file ( .py file ) with definitions and statements. The file name is the module name. After creating a module, we can use it any other module using “import” command.  Module is useful for re-usability of the code. You can write one function in one […]

## Python anonymous or lambda function : Python Tutorial 17

Python anonymous or lambda function : Anonymous or lambda functions are functions without a name. In python, we can create an anonymous function using a construct called “lambda” unlike “def” keyword we use to create other functions.  Difference between normal function and lambda function : def function1(x) : return x ** x function2 = lambda […]

## Python Function : Python Tutorial 16

Python Function tutorial : What is a function ?  Suppose you need to find the factorial of a number and you wrote a loop to calculate it. Again in the same project, factorial calculation is required again for a different number. In this case, we can write one similar “for” loop as before . But […]