Study Material: Introduction to Python (Variables & Data Types)
What is Python?
• Python is a popular programming language.
• It is used to create websites, games, apps, and more.
• Python is simple and easy to understand.
What is a Variable?
• A variable is like a container that stores information.
• You can give it a name and put a value in it.
• You can change the value of a variable later.
Example:
age = 12
name = "Asha"
Rules for Naming Variables
• Use letters, numbers, and underscores.
• Cannot start with a number.
• No spaces allowed.
• Example: student_name, score1
Python Data Types
Data Type What It Stores Example
Integer Whole numbers 10, -5, 0
Float Decimal numbers 3.14, -2.5
String Text (inside quotes) "Hello", 'A'
Boolean True or False values True, False
Example:
age = 13 # Integer
height = 4.5 # Float
name = "Rahul" # String
is_happy = True # Boolean
Practice Questions
Multiple Choice Questions (MCQ)
1. Which of these is a programming language?
o a) English
o b) Python
o c) Book
o d) Paint
Answer: b) Python
2. What is the correct way to create a variable in Python?
o a) 12 = age
o b) age = 12
o c) age == 12
o d) variable age 12
Answer: b) age = 12
3. What kind of value is stored by the variable name = "Arun"?
o a) Integer
o b) Float
o c) String
o d) Boolean
Answer: c) String
4. Which data type stores values like True or False?
o a) Integer
o b) String
o c) Boolean
o d) Float
Answer: c) Boolean
Fill in the Blanks
1. A variable is used to __________ information.
Answer: store
2. A string is always written inside __________.
Answer: quotes
3. The data type used for whole numbers is __________.
Answer: integer
4. In Python, 3.14 is an example of __________.
Answer: float
State True or False
1. A variable name can start with a number.
False
2. Python is easy to read and write.
True
3. True and False are examples of float data types.
False
4. "Hello" is a string in Python.
True
Question and Answer
Q1. What is a variable in Python?
A: A variable is a name used to store a value like a number or text so the program can use it later.
Q2. Name four basic data types in Python.
A:
1. Integer
2. Float
3. String
4. Boolean
Q3. Give an example of a variable storing a string.
A:
name = "Riya"
Q4. What are the rules for naming a variable?
A:
• It cannot start with a number.
• No spaces allowed.
• Use letters, numbers, and underscores.