Saturday, July 20, 2019

Python - Datatype


Every thing in python has a datatype. There are various types of datatypes in python. Broadly they are divided into numbers and strings. Let's have a look at both.

Python Numbers

Integers, float and complex numbers fall under python’s number category. They are represented in python in following ways:

Int

Integers can be of any length, it is only limited by the memory available.

Float

A floating point number is accurate up to 15 decimal places. Integer and floating points are separated by decimal points.

Complex

Complex numbers are written in the form, x + yj, where x is the real part and y is the imaginary part.

How would you know a data type of a variable?


type() function to know which class a variable or a value belongs.

type at work

Python Strings



String is sequence of unicode characters. We can use single quotes or double quotes to represent strings. Multiline strings can be denoted using triple quotes''' or """.

Conversion of data type

We can convert between different data types by using different type conversion functions like int(), float(), str() etc.



1 comment:

  1. Gambling in Las Vegas, NV - JTAH Hub
    There are no limits to gambling in Las Vegas. You can 여수 출장샵 gamble for free, 영주 출장샵 enjoy great 구리 출장샵 food 의정부 출장마사지 at an upscale casino, 파주 출장마사지 and enjoy a relaxing spa at the spa.

    ReplyDelete

Hadoop - What is a Job in Hadoop ?

In the field of computer science , a job just means a piece of program and the same rule applies to the Hadoop ecosystem as wel...