January 16

0 comments

Basic DataTypes

By Gulab Chand

January 16, 2020

basic datatypes

  • Every Variables in Python has a Datatype. In Python you do not need to declare any datatypes, you just write the variable and its value.
  • Python automatically decide the types based on our value.
  • Datatypes are created when you assign the value of variables.

Basic types:

                          1. Numeric

                          2. String

                          3. Boolean

1. PYTHON NUMERIC:

There are 3 types of Numeric.

  • Integers
  • Floating-point Numbers
  • Complex Numbers

1. Integers:

When you declare numbers, it comes into the Integer datatypes.

int

2. Floating-point Numbers:

  • Floating number is the decimal point numbers.
  • Floating point number is up to 15 decimal places.
  • E.g.   2 is integer, 2.5 is floating point number.

 

float

3. Complex Number:

  • It is used when you have complex problem
  • Its denoted by x + yj, where x and y are the real numbers and j is the imaginary unit.

 

complex

2 . Python String:

  • String is the collection of characters.
  • We can use single quotes( ‘ ) or double quotes( “ ) for declaring string.
  • We can use triple quotes ( ‘ ‘ ‘ ) or ( “ “ “ ) for creating Multi-line strings.

 

string

3. Python Boolean:

  • It is used when we have binary value. It means either 0 or 1 and you can say Yes/No.
  • Your answer is in between true and false or 0 and 1.

 

boolean

Gulab Chand

About the author

Gulab Chand Tejwani is an independent consultant.He is a Project Management professional (PMP) and Microsoft Certified Trainer (MCT). He has more then 15 years of experience in Microsoft technologies like Aspnet,SharePoint,Sql server and Cloud Computing as well as in Big Data and Hadoop,Mobile App development.He has also worked as technical project manager..

>