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

Python Variables DataTypes Student Friendly

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)
1 views3 pages

Python Variables DataTypes Student Friendly

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 Variables and Data Types - Quick Notes

1. What is a Variable?

A variable is like a container that holds data.

Example:

name = 'Charan' # Stores your name

age = 20 # Stores your age

2. Integer (int)

Used for whole numbers.

Example:

score = 100 # Marks scored in a test

3. Float (Decimal Number)

Used for decimal values.

Example:

temperature = 36.6 # Body temperature

4. String (Text)

Used to store text like names, messages.

Example:

message = 'Welcome to Python!'

5. Boolean (True/False)

Used for decisions.


Python Variables and Data Types - Quick Notes

Example:

is_student = True # Yes, you are a student

6. List (Group of items)

Used to store multiple values in one variable.

Example:

subjects = ['Math', 'Science', 'English']

# You can access: subjects[0] -> 'Math'

7. Tuple (Fixed group)

Like a list but cannot be changed.

Example:

days = ('Mon', 'Tue', 'Wed')

8. Set (Unique items)

Stores unordered unique items. No duplicates allowed.

Example:

roll_numbers = {101, 102, 103}

9. Dictionary (Key-Value pairs)

Used to store data with labels (keys).

Example:
Python Variables and Data Types - Quick Notes

student = {

'name': 'Charan',

'age': 20,

'grade': 'A'

# Access: student['name'] -> 'Charan'

You might also like