Wednesday, 20 July 2016

Number Data Type In python

Number data type is used to store  numeric  values in python . Number objects are created when you assign a  value to a particular variable using equal operator(=). Find the below syntax to define number data type in python;
Syntax:
variable name=value
Like we have taken the variable name as var1 and var2 and provide the value against them .
var1=10
var2=20
 There are four distinct numeric types  which  are given below:
*Integer
*long
*complex
*Float
Int(as integer) :   These are often called integer as int .This can contain both type of value either positive or negative with no decimal point, Find the below syntax for the same
Like:   30, 20, 40, 10

Long (long integer): This also contain the integer type of value having unlimited length. Difference between int and long  is just integer  type value is  defined normally just number(10)  but In case of long you will  define using  l in lowercase or uppercase .
Like: 8765902L
Float:A floating point number is accurate up to 15 decimal places .Integer and floating points are separated by decimal points. For example

1 this is integer but we define this as 1.0 that means now this is float.
softcrayons is a best institute for Python training in Ghaziabad.

No comments:

Post a Comment