|
7 | 7 | - `bin()`: Base 2 : 0 and 1
|
8 | 8 | - `oct()`: Base 8 : 0 through 7, & : Base 10 : The usual number system
|
9 | 9 | - `hex()`: Base 16 : 0 through 9 , A through F
|
| 10 | + |
| 11 | +##### Example: |
| 12 | +``` |
| 13 | +>>> myInt = 10 |
| 14 | +>>> print(myInt) |
| 15 | +10 |
| 16 | +``` |
10 | 17 | ### 2. Float
|
11 | 18 | - Represented as `float`.
|
12 | 19 | - Can store immensely large or icredibly small values
|
13 |
| -- E.g. of float: 2.1, 2.111, 43.2, 70.0, etc |
| 20 | +- E.g. of float: 2.1, 2.111, 43.2, 70.0, etc. |
| 21 | + |
| 22 | +##### Example: |
| 23 | +``` |
| 24 | +>>> myFloat = 10.1 |
| 25 | +>>> print(myFloat) |
| 26 | +10.1 |
| 27 | +``` |
| 28 | + |
| 29 | +### 3. Boolean Values |
| 30 | +- **True** or **False** |
| 31 | +- It consists of True or False value. |
| 32 | +- This value checks the condition and according to that will give the result. |
| 33 | + |
| 34 | +##### Example: |
| 35 | +``` |
| 36 | +>>> myBool = 1>2 |
| 37 | +>>> print(myBool) |
| 38 | +False |
| 39 | +>>> myBool1 = 2<3 |
| 40 | +>>> print(myBool1) |
| 41 | +True |
| 42 | +``` |
| 43 | + |
| 44 | +### 4. String |
| 45 | +- Normal English Sentence containing works, letters. |
| 46 | +- It is declared (usually) within double quotes e.g `mySent = "This is a string."` |
| 47 | + |
| 48 | +##### Example: |
| 49 | +``` |
| 50 | +>>> mySent = "This is a string." |
| 51 | +>>> print(mySent) |
| 52 | +This is a string. |
| 53 | +``` |
| 54 | +<hr> |
| 55 | + |
| 56 | +## Checking the Data Type |
| 57 | +Sometimes we often get confused in recognizing the data type of a variable and therefore we have a function which checks the data type of the particular variable. |
| 58 | +To check the type of data-type we need to call `type()` function. [Don't worry, we will learn about function in later episodes] |
| 59 | + |
| 60 | +##### Example: |
| 61 | +``` |
| 62 | +>>> print(type(myInt)) #Integer |
| 63 | +>>> print(type(myFloat)) #Float |
| 64 | +>>> print(type(myBool)) #Boolean |
| 65 | +>>> print(type(mySent)) #String |
| 66 | +<class 'int'> |
| 67 | +<class 'float'> |
| 68 | +<class 'bool'> |
| 69 | +<class 'str'> |
14 | 70 |
|
15 |
| -### 3. Complex Numbers |
16 |
| -- A complex number is a number that can be expressed in the form *a + bi*, where a and b are real numbers, and i is a symbol called the imaginary unit |
17 |
| -- ```myComplex = 3 +4j |
|
0 commit comments