# P2.2 Python Data Types: int, float, str आणि bool

Source: https://ravindrabagale.com/mr/datascience/py02-python-variables-and-data-types-explained-for-beginners/p2-2-python-data-types-int-float-str-and-bool.html
Language: mr (Marathi with English technical terms)

हे का शिकायचं?

प्रत्येक value चा type ठरवतो की तिच्यावर कोणतं काम करता येईल. "500" (text) आणि 500 (number) वेगळे आहेत.

हे काय आहे?

int म्हणजे पूर्ण संख्या, float म्हणजे दशांश संख्या, str म्हणजे text आणि bool म्हणजे True किंवा False. type() ने कुठल्याही value चा type कळतो.

कसं करायचं?

Step 1. Value लिहा.
Step 2. type(value) चालवा.
Step 3. Output मधला type वाचा.

उदाहरण A: चार types तपासा

```python
age = 34
balance = 2500.75
name = "Emma"
is_active = True
print(type(age))
print(type(balance))
print(type(name))
print(type(is_active))
```

Output:

```text
<class 'int'>
<class 'float'>
<class 'str'>
<class 'bool'>
```

याचा अर्थ: type() प्रत्येक value चा type दाखवतो: int, float, str, bool.

उदाहरण B: Number विरुद्ध number सारखा दिसणारा text

```python
a = 500
b = "500"
print(a + a)
print(b + b)
```

Output:

```text
1000
500500
```

याचा अर्थ: Text ची बेरीज म्हणजे जोडणं, number ची बेरीज म्हणजे गणित. CSV मधले आकडे बऱ्याचदा text असतात.

उदाहरण C: True आणि False सुद्धा numbers आहेत

```python
paid = [True, False, True]
print(sum(paid))
```

Output:

```text
2
```

याचा अर्थ: True = 1 आणि False = 0. म्हणून True values ची sum केली की count मिळतो.

रवींद्र बागले यांची tip

Data load केल्यावर लगेच types तपासा. एक `type()` (पुढे `df.dtypes`) चुकीच्या totals पासून वाचवतो.
