Docstring in python : A docstring is a string that is used for documentation of a module,function,class or method in python. This string comes as the first statement after the name of the function , module etc . The value of a docstring can be printed out by using _doc_ attribute of the object. So,…

# python

## Python Program to find if a number is Armstrong or not

Find if a number is Armstrong or not using python : A three digit number is called a Armstrong number if the sum of cube of its digits is equal to the number itself. 407 is an Armstrong number since 4**3 + 0**3 + 7**3 = 407 For a number with ‘n’ digits, the power…

## Python program to sort all words of a string in alphabetical order

Write a python program to sort all words of a String in Alphabetical order : If you are not familiar with python string methods and loops, go through python string and python loop tutorials first. To sort all words of a string, first we need to extract each word and store them somewhere. In this…

## Python Program to find LCM of two numbers

Find LCM of two numbers in python : What is a LCM ? LCM or least common multiplier of two number is the smallest number that is divisible by both of these numbers. i.e. the lowest number starting from 1, that is divisible by both. To find out the LCM of two numbers in python…

## How to check if a date is valid or not in python

Python program to check if a date is valid : In this tutorial, we will check if a date is valid or not usng python. Solution : 1. Get the input from the user 2. Input should be in the form of dd/mm/yy 3. Extract the inputs in different variables 4. use ‘datetime’ module to…

## Count number of digits in a number in Python

Count the number of digits in a number using python : Using python, count the number of digits in a number. Get the input from user and print out the result. We will show you two different ways to calculate digits . Solution 1 : 1. Take the user input , create one variable to…

## Find average of numbers in a list using python

Calculate the average of numbers in a list using python : In this tutorial, we are going to show you three different ways to calculate average of numbers of a list in python.We are using python3 version 3.6.1 . You can check your python3 version by running python3 –version command on a terminal. 1. We…

## Using pip in python : Python tutorial 29

What is pip : pip is a package management system , we can use it to install and manage software packages in python. pip is included by default for python 2.7.9 and later . For python3, it is called pip3 which is also included by default for Python 3.4 and later . Installing pip :…

## Find the Area of a circle in python : Python tutorial 28

Find the Area of a circle in python : We know that the area of a circle is π r² , where “r” is the radius of the circle. Since π is constant , to calcutate the area, we need only the radius value from the user . The value of π is 3.1415 upto…

## Python Calendar Module : Python Tutorial 27

Python Calendar module : ”Calendar” module in python is useful for displaying calendar and for doing other useful tasks related to the calendar . For using it, we need to import first “calendar” module. Let’s try to print current month ( July, 2017 ) using python “calendar” module : import calendar year = 2017 month…