|

Data Type Part 1 | Python Tutorial in Sinhala Learn Basic of Python Programming #3 Video

Watch the video before you read this.

Let’s talk about Data Types

There are 3 main types of data types.

  1. Numeric
  2. Sequence
  3. Dictionary

We learn under Numeric,

  1. Integer
  2. Float
  3. Boolean
  4. String
  5. Complex

Let`s move to the Python Shell. Open Python Shell now.

First we will learn about Integers. Integers mean non decimal numbers.

For an example for integers,

x = 10
type(x)

answer

<class 'int'>

Now you can see the answer is ‘int’ that means integer.

Second data type is Float. The float is the opposite side of the integer.in other word Floats mean decimal numbers

Let’s see an example,

y = 2.2
z = 5.5
type ( y )

answer

class 'float'

Now you can see the answer is ‘float’ that means Float.

Then let’s discuss about Booleans. 1 or 0 / True or False ,these are used in Booleans.

g = 2
h = 1
g > h

answer

False

Yes true because number 2 is bigger than 1 you can understand it well.

We can get the answer to the previous example in another way let`s do it

t = bool(g < h)

answer

False

Now you can see the answer the same as the previous answer. Okay, I think these examples are helpful for you to understanding Boolean.

Let’s talk about last numeric data type. It is complex.

For an example,

w = 2 + 4j
type (w)

answer

class 'complex'

Now you can see the answer is complex. What is that “j” that is the imaginary value. Okay I think this example is useful for you to understanding about complex.

So that`s all We talked about in this video I hope you will learn anything from this video.

Subscribe My Channel for watch More Educational Contents.

Thank You.

Similar Posts

Leave a Reply

Your email address will not be published.