Python Basics - Quick Guide
1. Introduction
Python is a high-level, interpreted programming language known for its simple syntax and
readability.
2. Variables and Data Types
Variables store data values. Python is dynamically typed, so you don't declare types explicitly.
1 int – integers
2 float – decimal numbers
3 str – text
4 bool – True/False
5 list, tuple, set, dict – collections
3. Operators
Type Examples
Arithmetic + - * / % ** //
Comparison == != > < >= <=
Logical and or not
4. Conditional Statements
if, elif, else are used for decision making.
Example: if x > 10: print('Big') else: print('Small')
5. Loops
for and while loops repeat actions.
Example: for i in range(5): print(i)
6. Functions
Functions are reusable blocks of code.
Example: def greet(name): return 'Hello ' + name
7. Lists
Lists store multiple values and are mutable.
Example: nums = [1,2,3] [Link](4)
8. Dictionaries
Store key-value pairs. Example: student = {'name':'Raj', 'age':20}
9. File Handling
open(), read(), write(), close() used to work with files.
10. Conclusion
Practice coding daily to master Python.