Complet Programming Language
Complet Programming Language
● What is a database?
● What is SQL?
● Simple to advanced queries with examples like: “get customers who paid more than
₹10,000”
📌 Format of Notes
For each topic:
Code Example:
python
CopyEdit
age = 20
if age >= 18:
print("You can vote")
else:
print("You cannot vote")
●
● What it means:
If age is 18 or more, say "You can vote", otherwise say "You cannot vote".
●
Perform calculations
● Make websites
● Train AI models
| 💻 Code Example: |
python
CopyEdit
print("Hello Yaara!")
| 📘 Output: |
nginx
CopyEdit
Hello Yaara!
| ✅ Use it when: |
● You want to see what’s happening in the code.
✅ Chapter 3: Variables
| 🧠 What are variables? |
Variables are containers to store data. Like a box with a label.
Here:
python
CopyEdit
print(name) # Output: Sabita
print(age) # Output: 23
| ✅ Why used: |
● To reuse values
| 💻 Code: |
python
CopyEdit
price = 50.75
name = "Laptop"
in_stock = True
| 💻 Code Example: |
python
CopyEdit
age = 17
| 🧠 Output: |
nginx
CopyEdit
You cannot vote
| 💻 Code Example: |
python
CopyEdit
name = input("What's your name? ")
print("Hello " + name)
| ✅ Output Example: |
rust
CopyEdit
What's your name? Sabita
Hello Sabita
✅ Chapter 7: for and while Loops – Repeat Tasks
| 🔁 Why Loops? |
When you want to repeat something multiple times.
⏱ Output:
nginx
CopyEdit
Hello Yaara!
Hello Yaara!
Hello Yaara!
⏱ Output:
nginx
CopyEdit
Keep Learning!
Keep Learning!
Keep Learning!
✅ Chapter 8: Functions – Reusable Blocks
| 📦 What is a function? |
A function is a block of code you write once and use many times.
| 💻 Example: |
python
CopyEdit
def greet():
print("Hello Yaara!")
| 💻 Example: |
python
CopyEdit
fruits = ["apple", "banana", "mango"]
print(fruits[0]) # Output: apple
| ✅ Why Used: |
● To store user data
🔜 Coming Next:
➡️ Phase 1, Part 2: Pandas, NumPy, Matplotlib
➡️ After that: SQL, Databases, ML, Deep Learning, Projects
➡️ I’ll convert all phases into PDFs after each part for lifetime revision
● Load data
● Clean it
● Filter rows/columns
● Do calculations
| 💻 Import: |
python
CopyEdit
import pandas as pd
📦 Common Pandas Tasks:
Task Code Meaning
💻 Example:
python
CopyEdit
import pandas as pd
df = pd.read_csv("sales.csv")
print(df.head())
print(df["Revenue"].sum())
| 💻 Import: |
python
CopyEdit
import numpy as np
Create np.array([1, 2,
array 3])
Mean np.mean(arr)
Zeros np.zeros((2,3))
Random np.random.rand(3
, 3)
💻 Example:
python
CopyEdit
import numpy as np
| Output: |
makefile
CopyEdit
Average: 88.75
✅ Chapter 14: Matplotlib – Make Beautiful Graphs
| 📊 What is it? |
Matplotlib is used to create charts (line, bar, pie, scatter, etc.)
| 💻 Import: |
python
CopyEdit
import matplotlib.pyplot as plt
plt.plot(x, y)
plt.title("Sales Over Time")
plt.xlabel("Week")
plt.ylabel("Sales")
plt.show()
| Output: |
plt.bar(cities, sales)
plt.title("City-wise Sales")
plt.show()
✅ Chapter 15: Seaborn – Better Graphs
| 🔹 What is Seaborn? |
Seaborn = Matplotlib ka stylish version
Helps create graphs with less code.
| 💻 Import: |
python
CopyEdit
import seaborn as sns
🔸 Example:
python
CopyEdit
import seaborn as sns
import pandas as pd
df = pd.read_csv("sales.csv")
sns.barplot(x="City", y="Revenue", data=df)
💻 Code:
python
CopyEdit
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("orders.csv")
| 🔥 What it does: |
● Loads file
🧠 Summary of Part 2:
Tool Purpose
🔥
pros!
After that ➝ ML starts!
| 💡 Example |
sql
CopyEdit
SELECT * FROM customers WHERE city = 'Bangalore';
| 💻 Sample |
sql
CopyEdit
SELECT name, age
FROM employees
WHERE age >= 25
ORDER BY age DESC
LIMIT 3;
✅ Chapter 20: Filtering with WHERE
sql
CopyEdit
SELECT * FROM products
WHERE price > 500 AND category = 'Electronics';
INSERT Add new data INSERT INTO users (name, age) VALUES
('Rahul', 25);
DELETE Remove data DELETE FROM users WHERE age < 18;
Type Meaning
💻 Example:
sql
CopyEdit
SELECT users.name, orders.amount
FROM users
INNER JOIN orders
ON users.id = orders.user_id;
| Meaning: |
"Show user names with their order amounts"
id nam city
e
1 Riya Delhi
2 Amit Mumbai
3 Sara Bangalore
id user_i amount
d
1 1 1200
2 3 800
💻 Query:
sql
CopyEdit
SELECT customers.name, orders.amount
FROM customers
JOIN orders ON customers.id = orders.user_id;
✅ Output:
yaml
CopyEdit
Riya 1200
Sara 800
python
CopyEdit
import sqlite3
python
CopyEdit
import pandas as pd
df = pd.read_sql("SELECT * FROM customers", connection)
🧠 Summary of Phase 2:
You Learned Why It's Powerful
🔜 Next Chapter:
PHASE 3 – MACHINE LEARNING FUNDAMENTALS:
💥
What is ML, how does it work, types of ML, real-world examples, Python libraries, training your
first model
| 💡 Real-Life Examples |
App What ML Does
🧠 Flow of ML:
mathematica
CopyEdit
Input Data → Train Model → Predict Output → Improve
| Example: |
text
CopyEdit
Data: [Age, Income] → [Buy / Not Buy]
"If age > 25 and income > 50K → most likely will buy"
| 💡 Example Table |
Hours Exam
Studied Score
2 50
4 70
6 90
# Data
data = {'Hours': [2, 4, 6], 'Score': [50, 70, 90]}
df = pd.DataFrame(data)
| 💡 Example: |
Group customers into:
● Low spenders
● Medium spenders
● High spenders
| 🧠 Algorithm Used: |
● K-Means Clustering
💻 Example (Unsupervised)
python
CopyEdit
from sklearn.cluster import KMeans
import pandas as pd
model = KMeans(n_clusters=2)
model.fit(df)
print(model.labels_)
✅ Output:
csharp
CopyEdit
[1 1 0 0 0 0]
5. Predict .predict()
🧠 Summary of Phase 3:
What You Learned Why It’s Important
What is ML Foundation of AI
🔜 Coming Next:
✅ PHASE 4 – ADVANCED ML + MODEL EVALUATION
● Accuracy, precision, recall
● Feature engineering
● End-to-end project 🔥
📘 PHASE 4 – ADVANCED ML CONCEPTS
+ MODEL EVALUATION
Regression MAE, MSE, RMSE How far predictions are from actual
🔸 Confusion Matrix
Predicted \ Positiv Negativ
Actual e e
Positive TP FP
Negative FN TN
●
TP = True Positive (correct yes)
| 💡 Real Life: |
● Overfit = Student memorized past papers, fails actual test
| ✅ Solution: |
● Use cross-validation
● Use regularization
💻 Example:
python
CopyEdit
from sklearn.model_selection import cross_val_score
| 🛠️ Techniques: |
● Handling missing data
● Removing outliers
● Converting text to numbers
● Sex
● Age
● Fare
df = pd.read_csv("titanic.csv")
model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
# Save
joblib.dump(model, 'titanic_model.pkl')
# Load later
model = joblib.load('titanic_model.pkl')
✅ You can now use this model in a Flask or Streamlit app.
🧠 Summary of Phase 4:
Concept Why It’s Important
🔜 Coming Next:
✅ PHASE 5 – DEEP LEARNING (Neural Networks, CNN, RNN, NLP)
Get ready for:
| 💡 Real-Life Examples |
App What Deep Learning Does
css
CopyEdit
Input → Hidden Layers → Output
We'll start with TensorFlow + Keras since it’s best for beginners.
# Load Data
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# Normalize data
x_train = x_train / 255.0
x_test = x_test / 255.0
# Build Model
model = Sequential([
Flatten(input_shape=(28, 28)),
Dense(128, activation='relu'),
Dense(10, activation='softmax')
])
# Evaluate
test_loss, test_acc = model.evaluate(x_test, y_test)
print("Test Accuracy:", test_acc)
✅ Output:
yaml
CopyEdit
Test Accuracy: ~98%
| 💡 Use Cases |
● Face detection
Flatten Convert 2D to 1D
💻 Example CNN:
python
CopyEdit
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten,
Dense
model = Sequential([
Conv2D(32, (3,3), activation='relu', input_shape=(28,28,1)),
MaxPooling2D((2,2)),
Flatten(),
Dense(64, activation='relu'),
Dense(10, activation='softmax')
])
● Texts
● Chat messages
● Stock prices
● Sensor readings
| 💡 Example: |
Predict next word in sentence, or next day’s stock price
| 💬 Used in: |
● ChatGPT
● Google Translate
● WhatsApp auto-reply
● Text summarizers
✅ Output:
scss
CopyEdit
Sentiment(polarity=0.5, subjectivity=0.6)
● ChatGPT
● BERT
● DALL·E
● Whisper (audio)
| 🧠 Why special? |
● Understands context
🔜 Coming Next:
✅ PHASE 6 – DATA SCIENCE TOOLS & AI PROJECT DEPLOYMENT
● Google Colab, Jupyter, Power BI
| 💡 Why used: |
● Clean way to explain and run ML/AI code
| 🔥 Bonus: |
Run in browser with Anaconda or Google Colab
| 💪 Features: |
● Free GPU for training Deep Learning
| ✅ Start Here: |
https://colab.research.google.com
| 🧠 What is GitHub? |
A cloud platform to host your code publicly or privately
| 💡 Why it matters: |
● You show your projects to the world
● Add it in resume/portfolio
| 💡 Use Cases: |
● Business reports
● Sales analysis
● Customer insights
| ✅ Alternative: |
● Tableau
| 🤖 Example: |
● Upload a CSV file → get predictions
| 💻 Example Code: |
python
CopyEdit
import streamlit as st
| ✅ Run: |
bash
CopyEdit
streamlit run app.py
| 🔥 Use Cases: |
● Host AI model on website
app = Flask(__name__)
@app.route('/')
def hello():
return "Welcome to My AI App!"
if __name__ == '__main__':
app.run(debug=True)
● Built-in docs
| 💡 When to choose: |
Use Flask if you're a beginner
Use FastAPI for pro-level projects
3. Go to https://streamlit.io/cloud
● Write: "Built an ML model to predict loan approval with 87% accuracy using
Logistic Regression, deployed via Streamlit"
🧠 Summary of Phase 6:
Tool Purpose
| Dataset Columns |
● Education, Self_Employed
● ApplicantIncome, LoanAmount
● Credit_History, Property_Area
● Loan_Status (Y/N)
| Algorithm |
● Logistic Regression / Random Forest
| Output |
| Input | Hours
| Output | Predicted Marks
| Algorithm |
● Linear Regression
| Deploy With |
| Steps |
| Tools |
| Library |
| Dataset |
● MovieLens Dataset
| Techniques |
● Cosine Similarity
● Collaborative Filtering
| Technique |
● KMeans Clustering
| Visualize With |
● Seaborn, Matplotlib
● 0 (No) or 1 (Yes)
| Dataset |
| Algorithm |
| Tools |
● TfidfVectorizer, PassiveAggressiveClassifier
● MNIST
| Model |
| Deployment |
| Tools |
● OpenCV + TensorFlow
| Deployment |
| Tools |
● Streamlit UI