|
|
|
Beginner-friendly overview of Python fundamentals including setup,
variables, operators, input/output, and simple coding examples for
data science learners. |
💻 What is programming?
- Programming means writing instructions that tell a computer what to do.
- We use programming to solve problems, automate tasks, and build applications.
- One of the most popular languages today is Python because it is easy to learn, powerful, and widely used in Artificial Intelligence 🤖 and Data Science 📊.
🌟 Why Python is Popular
- ✔ Simple syntax — readable like English
- ✔ Huge ecosystem for AI, ML, and Data Analysis
- ✔ Cross-platform and open source
- ✔ Strong community support
💡Vocabulary
Ecosystem — Tools and resources like libraries, frameworks, and documentation.
Cross-platform - can run on different operating systems (Windows, Linux, macOS) without changing the code.
🖥 IDE vs Editor
A Code Editor is a simple tool to write code (example: VS Code). An IDE (Integrated Development Environment) provides extra tools like debugging, auto-build, and project management.
- Editor ➜ Lightweight, fast, basic coding
- IDE ➜ Full development features
📓 What is Jupyter Notebook
Jupyter Notebook is an interactive coding environment popular in Data Science. It allows:
- Running code in small blocks
- Mixing text, charts, and code
- Easy experimentation and visualization 📊
⚙️ Installing Python & Setup
- Install Python
- Choose VS Code, PyCharm, or Jupyter
- Test installation:
print("Hello World")
📦 Variables & Data Types
Variables store values in memory. Python uses dynamic typing, meaning you don’t declare type explicitly.
x = 10 x = "Hello"
Python automatically changes the type — this is called Dynamic Typing.
✅ Rules for Naming Variables
- Start with letter or underscore
- No spaces allowed
- Cannot use keywords
- Case sensitive
valid_name = 10 _user = "ok"
📚 Built-in Python Data Types
- Text ➜ str
- Numeric ➜ int, float, complex
- Sequence ➜ list, tuple, range
- Mapping ➜ dict
- Set ➜ set, frozenset
- Boolean ➜ bool
🔢 Python Numeric Types
a = 10 # int b = 3.14 # float c = 2+3j # complex
➕ Operators
- Arithmetic ➜ + , - , * , /
- Comparison ➜ == , !=, > , <
- Logical ➜ and, or, not
x = 10 y = 5 print(x + y)
📥 Input & 📤 Output
name = input("Enter name: ")
print("Hello", name)
🔄 Type Conversion
num = "10" converted = int(num)
💬 Comments & Documentation
# Single line comment """ Multi line documentation """
🛠 Practical Section
🧮 Simple Calculator
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Addition:", a + b)
print("Subtraction:", a - b)
🙋 User Input Example
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Welcome", name)
print("You are", age, "years old")
Learning these fundamentals builds the foundation for advanced tools like NumPy, Pandas, Machine Learning, and AI 🚀.
