1 2-Datatypes
1 2-Datatypes
ipynb - Colab
keyboard_arrow_down DataTypes
1. Definition:
Data types are a classification of data which tell the compiler or interpreter how the
programmer intends to use the data.
They determine the type of operations that can be performed on the data, the values that the
data can take, and the amount of memory needed to store the data.
Video Outline:
Integers
Floating-point numbers
Strings
Booleans
4. Advanced Data Types
Lists
Tuples
Sets
Dictionaries
5. Type Conversion
6. Practical Examples
## Integer Example
age=35
type(age)
int
https://colab.research.google.com/drive/1prantC-bWbhDcWg-Zn9uNaFGJIcXMMws#printMode=true 1/3
7/16/24, 7:17 PM 1.2-Datatypes.ipynb - Colab
5.11
<class 'float'>
Krish
<class 'str'>
## boolean datatype
is_true=True
type(is_true)
bool
a=10
b=10
type(a==b)
bool
## common errors
result="Hello" + 5
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[12], line 3
1 ## common errors
----> 3 result="Hello" + 5
result="Hello" + str(5)
print(result)
https://colab.research.google.com/drive/1prantC-bWbhDcWg-Zn9uNaFGJIcXMMws#printMode=true 2/3
7/16/24, 7:17 PM 1.2-Datatypes.ipynb - Colab
Hello5
https://colab.research.google.com/drive/1prantC-bWbhDcWg-Zn9uNaFGJIcXMMws#printMode=true 3/3