Python_Basics_Class11
Python_Basics_Class11
1. Introduction to Python
Python is a high-level, interpreted programming language that is easy to learn and widely used in
various fields.
Features of Python:
Example:
if 10 > 5:
name = "Alice"
age = 16
height = 5.7
3. Data Types in Python
5. Conditional Statements
else:
6. Loops in Python
For loop:
print(i)
While loop:
x=1
while x <= 5:
print(x)
x += 1
7. Functions in Python
def greet(name):
print("Hello,", name)
greet("Alice")
Lists (Mutable):
fruits.append("Mango")
Tuples (Immutable):
print(student["name"])
Writing to a file:
f.write("Hello, Python!")
Reading from a file:
content = f.read()
print(content)
Conclusion
Python is a powerful yet easy-to-learn programming language. Understanding the basics such as
syntax, variables, loops, functions, and file handling is essential for Class 11 Computer Science.