Python_Basics_Class11_Colored
Python_Basics_Class11_Colored
1. Introduction to Python
Python is a high-level, interpreted programming language that is simple and widely used in various
fields.
Features of Python:
Example:
if 10 > 5:
print('10 is greater than 5')
4. Conditional Statements
Python Basics - Class 11 Computer Science
Example:
if age >= 18:
print('You are an adult.')
elif age >= 13:
print('You are a teenager.')
else:
print('You are a child.')
5. Loops in Python
6. Functions in Python
def greet(name):
print('Hello,', name)
greet('Alice')
Lists (Mutable):
fruits = ['Apple', 'Banana', 'Cherry']
fruits.append('Mango')
Python Basics - Class 11 Computer Science
Tuples (Immutable):
colors = ('Red', 'Green', 'Blue')
Writing to a file:
with open('file.txt', 'w') as f:
f.write('Hello, Python!')
Conclusion
Python is an easy and powerful programming language. Mastering these basics will help you build
advanced programs in the future.