1.
1 Basics of Python Programming
1. Applications of Python
Python is a powerful, high-level, interpreted language widely used in:
Web Development – using frameworks like Django, Flask.
Data Science & Machine Learning – libraries such as Pandas, NumPy, Scikit-learn.
Automation/Scripting – automating repetitive tasks (e.g., file handling, sending
emails).
Game Development – with libraries like Pygame.
Desktop Applications – using Tkinter, PyQt.
Embedded Systems & IoT – with MicroPython or Raspberry Pi.
Cybersecurity – for writing scripts, automating tasks, or penetration testing.
2. Writing and Running Python Scripts
Python scripts can be written using:
Text editors like VS Code, Sublime Text.
IDEs like PyCharm, Thonny.
Saved with a .py extension (e.g., [Link]).
To run:
Open terminal/command prompt and type:
bash
CopyEdit
python [Link]
Or use an IDE’s Run button.
3. Variables, Assignments, and Keywords
Variables store data values:
python
CopyEdit
name = "Alice"
age = 25
Assignment uses the = operator.
Keywords are reserved words that cannot be used as identifiers (e.g., if, else,
while, def, class).
Use the keyword module to see all:
python
CopyEdit
import keyword
print([Link])
4. Input and Output Operations
Input: input() is used to get user input.
python
CopyEdit
name = input("Enter your name: ")
Output: print() is used to display output.
python
CopyEdit
print("Hello", name)
5. Code Indentation and Its Importance
Indentation defines code blocks in Python.
No braces {}, indentation is mandatory.
Example:
python
CopyEdit
if age > 18:
print("Adult")
else:
print("Minor")
Incorrect indentation leads to IndentationError.