Introduction to Python
Python is a high-level, interpreted programming language known for its simplicity and readability. It
is widely used in web development, data science, artificial intelligence, and automation.
Features of Python
• Easy to learn and use • Interpreted language • Object-oriented • Large standard library • Portable
Variables
Variables are used to store data values. Example: x = 10
Data Types
Common data types include: • int • float • str • list • tuple • dict
Operators
Operators are used to perform operations on variables. Examples: +, -, *, /, %, ==
Conditional Statements
Used for decision making. Example: if x > 0: print('Positive')
Loops
Loops are used to repeat a block of code. Types: • for loop • while loop
Functions
Functions are reusable blocks of code. Example: def add(a, b): return a + b
Lists
Lists are ordered collections. Example: my_list = [1, 2, 3]
Tuples
Tuples are immutable collections. Example: my_tuple = (1, 2, 3)
Dictionaries
Dictionaries store data in key-value pairs. Example: my_dict = {'a': 1, 'b': 2}
Conclusion
Python is a powerful and flexible language suitable for beginners and professionals.