0% found this document useful (0 votes)
3 views3 pages

Python DataTypes Beginner Kashaf

The document explains data types in Python, which are the kinds of values a variable can store. It covers four main data types: Integer (int), Float (float), String (str), and Boolean (bool), providing examples and usage for each. Additionally, it includes a quick tip to remember the characteristics of each data type.

Uploaded by

binteidrees69
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Python DataTypes Beginner Kashaf

The document explains data types in Python, which are the kinds of values a variable can store. It covers four main data types: Integer (int), Float (float), String (str), and Boolean (bool), providing examples and usage for each. Additionally, it includes a quick tip to remember the characteristics of each data type.

Uploaded by

binteidrees69
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming

Lesson – Data Types Explained


Prepared by: Kashaf Idrees
BS IT, University of Sargodha
What are Data Types?

Data types are the kind of values a variable can store. Every variable has a data type, so Python
knows how to use it.

1. Integer (int) – Whole Numbers

Examples: 5, 100, -3
```python
age = 18
print(age) # Output: 18
```
Used for whole numbers like age, count, marks.

2. Float (float) – Decimal Numbers

Examples: 3.14, 2.5, -0.99


```python
price = 45.50
print(price) # Output: 45.5
```
Used for money, temperature, or measurements.

3. String (str) – Text

Text must be inside quotes: " " or ' '


Examples: "Kashaf", "BS IT", "Hello World"
```python
name = 'Kashaf'
print(name) # Output: Kashaf
```
Used for names, messages, or any text.

4. Boolean (bool) – True / False

Only two values: True or False


```python
is_student = True
print(is_student) # Output: True
```
Used for conditions and yes/no questions.
Example – All Data Types Together

```python
age = 18 # int
height = 5.5 # float
name = 'Kashaf' # string
is_student = True # boolean
print(age, height, name, is_student)
```
Output:
18 5.5 Kashaf True

Quick Tip to Remember

- Int → Whole number


- Float → Decimal number
- String → Text
- Boolean → True/False

You might also like