https://claude.ai/public/artifacts/d515bb8c-40dd-4d9a-9010-beb96f6aa4e5
Machine Learning With Python
Monday, August 10, 2026
Thursday, August 6, 2026
Friday, December 19, 2025
Python Viva Questions
Basic Python Viva Questions
1. What is Python?
Python is a high-level, interpreted, and object-oriented programming language used for web development, data science, AI, automation, and more.
2. Who developed Python?
Python was developed by Guido van Rossum in 1991.
3. Why is Python popular?
-
Easy to learn and read
-
Large standard library
-
Platform independent
-
Supports multiple programming paradigms
4. What are Python features?
-
Interpreted language
-
Dynamically typed
-
Object-oriented
-
Portable
-
Open-source
5. What is an interpreter?
An interpreter executes code line by line, making debugging easier.
Data Types & Variables
6. What are Python data types?
-
int
-
float
-
complex
-
str
-
list
-
tuple
-
set
-
dict
-
bool
7. What is a variable?
A variable is a name that stores data in memory.
Example:
x = 10
8. Is Python dynamically typed?
Yes, Python does not require variable type declaration.
9. Difference between list and tuple?
| List | Tuple |
|---|---|
| Mutable | Immutable |
| Uses [] | Uses () |
| Slower | Faster |
10. What is a dictionary?
A dictionary stores data in key–value pairs.
Example:
student = {"name": "Ram", "age": 20}
Operators & Control Statements
11. Types of operators in Python?
-
Arithmetic
-
Relational
-
Logical
-
Assignment
-
Bitwise
-
Membership
-
Identity
12. What are control statements?
They control program flow:
-
if, elif, else
-
for loop
-
while loop
-
break, continue, pass
13. What is a loop?
A loop executes a block of code repeatedly.
Functions & Modules
14. What is a function?
A function is a reusable block of code.
Example:
def add(a, b):
return a + b
15. What is a module?
A module is a file containing Python code (functions, variables).
Example:
import math
16. What is a package?
A package is a collection of modules.
OOP in Python
17. What is OOP?
Object-Oriented Programming organizes code using objects and classes.
18. What is a class?
A class is a blueprint for creating objects.
19. What is an object?
An object is an instance of a class.
20. OOP principles?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
File Handling & Exceptions
21. How to open a file in Python?
file = open("data.txt", "r")
22. What is exception handling?
Handling runtime errors using:
try-except
23. What is finally block?
It executes whether an exception occurs or not.
Advanced & Miscellaneous
24. What is PEP 8?
PEP 8 is the Python style guide.
25. What is slicing?
Extracting part of a sequence.
Example:
s = "Python"
print(s[1:4])
26. What is lambda function?
A small anonymous function.
Example:
x = lambda a: a * 2
27. What is list comprehension?
A concise way to create lists.
Example:
squares = [x*x for x in range(5)]
28. What is virtual environment?
An isolated environment for Python projects.
29. What is NumPy?
NumPy is a library for numerical computations.
30. What is Pandas?
Pandas is used for data analysis and data manipulation.
31. What is indentation in Python?
Indentation defines blocks of code. Python uses indentation instead of braces {}.
32. What happens if indentation is wrong?
Python raises an IndentationError.
33. What is pass statement?
pass is a null statement used when no action is required.
34. What is break and continue?
-
breakexits the loop -
continueskips the current iteration
35. What is range() function?
Generates a sequence of numbers.
Example:
range(1, 10, 2)
36. What is type casting?
Converting one data type into another.
Example:
int("10")
37. Difference between is and ==?
-
==checks value equality -
ischecks memory location
38. What is None?
None represents absence of a value.
39. What is mutable and immutable?
-
Mutable: list, dict, set
-
Immutable: int, float, tuple, string
40. What is a namespace?
A namespace is a mapping of names to objects.
Functions & Arguments
41. Types of function arguments?
-
Positional
-
Keyword
-
Default
-
Variable-length (
*args,**kwargs)
42. What is recursion?
A function calling itself.
43. What is *args?
Used to pass multiple positional arguments.
44. What is **kwargs?
Used to pass multiple keyword arguments.
45. What is docstring?
A string that describes a function or module.
Example:
def fun():
"""This is a docstring"""
Strings & Collections
46. String methods in Python?
-
upper()
-
lower()
-
split()
-
replace()
-
strip()
47. What is slicing in list?
Extracting part of a list.
Example:
lst[1:4]
48. What is set?
An unordered collection of unique elements.
49. Why dictionary keys must be unique?
Keys act as identifiers for values.
50. Difference between shallow copy and deep copy?
-
Shallow copy: copies references
-
Deep copy: copies all objects
File Handling
51. File modes in Python?
-
r– read -
w– write -
a– append -
r+– read & write
52. What is with statement?
Used for automatic file closing.
53. How to read CSV file in Python?
Using csv or pandas module.
Exception Handling
54. Types of errors in Python?
-
Syntax Error
-
Runtime Error
-
Logical Error
55. What is raise keyword?
Used to create custom exceptions.
56. Multiple except blocks—why?
To handle different exceptions separately.
OOP – Advanced
57. What is constructor?
A special method __init__() used to initialize objects.
58. What is destructor?
__del__() method used to destroy objects.
59. What is method overloading?
Multiple methods with same name but different parameters
(Note: Python supports it using default arguments).
60. What is method overriding?
Child class redefining parent class method.
Advanced Python Concepts
61. What are generators?
Functions that return an iterator using yield.
62. What is yield keyword?
Used to return values one at a time.
63. What are decorators?
Functions that modify other functions.
64. What is multithreading?
Executing multiple threads simultaneously.
65. What is GIL?
Global Interpreter Lock allows only one thread execution at a time in CPython.
Libraries & Tools
66. What is Matplotlib?
A library for data visualization.
67. What is Scikit-learn?
A machine learning library.
68. What is Django?
A high-level web framework.
69. What is Flask?
A lightweight web framework.
70. What is pip?
Package installer for Python.
Practical & Project Viva
71. How to improve Python code performance?
-
Use efficient algorithms
-
Use built-in functions
-
Avoid unnecessary loops
72. What is virtual environment used for?
To manage project dependencies separately.
73. What is version control?
Tracking changes using tools like Git.
74. Difference between Python 2 and Python 3?
Python 3 supports Unicode by default and better syntax.
75. What is API?
Application Programming Interface allows communication between software.
Thursday, December 11, 2025
COVID-19 Dataset Analysis Project
COVID-19 Dataset Analysis Project (Using Kaggle Dataset)
(Python · Pandas · Matplotlib)
1. Project Title
COVID-19 Data Analysis Using Python (Exploratory Data Analysis on Global COVID Statistics)
2. Dataset Source
Download from Kaggle:
“Novel Corona Virus 2019 Dataset” or
“COVID-19 World Vaccination Progress”
Search on Kaggle → Download CSV.
You will mainly use:
-
covid_19_data.csv -
time_series_covid_19_confirmed.csv -
time_series_covid_19_deaths.csv -
time_series_covid_19_recovered.csv
3. Project Objectives
✔ Understand global COVID-19 spread through data
✔ Identify most affected countries
✔ Visualize daily vs cumulative cases
✔ Analyze death & recovery trends
✔ Explore correlation between features
✔ Perform country-wise time-series analysis
4. Python Libraries Required
pip install pandas matplotlib seaborn numpy
5. Import Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
6. Load Dataset
df = pd.read_csv("covid_19_data.csv")
df.head()
7. Basic Data Information
df.info()
df.isnull().sum()
df.describe()
8. Data Cleaning
Rename messy column names:
df.rename(columns={
'Country/Region': 'Country',
'Province/State': 'State',
'ObservationDate': 'Date'
}, inplace=True)
Convert date:
df['Date'] = pd.to_datetime(df['Date'])
Fill missing values:
df['State'] = df['State'].fillna('')
9. Global Numbers Overview
Total Confirmed, Deaths, Recovered
total_confirmed = df['Confirmed'].sum()
total_deaths = df['Deaths'].sum()
total_recovered = df['Recovered'].sum()
print(total_confirmed, total_deaths, total_recovered)
10. Country-wise Summary
country_summary = df.groupby("Country")[["Confirmed","Deaths","Recovered"]].max().sort_values("Confirmed", ascending=False)
country_summary.head(10)
11. Plot: Top 10 Countries by Confirmed Cases
top10 = country_summary.head(10)
plt.figure(figsize=(10,6))
plt.bar(top10.index, top10['Confirmed'])
plt.xticks(rotation=45)
plt.title("Top 10 Countries with Highest Confirmed Cases")
plt.xlabel("Country")
plt.ylabel("Confirmed Cases")
plt.show()
12. Death Rate and Recovery Rate
country_summary["Death_Rate"] = (country_summary["Deaths"] / country_summary["Confirmed"]) * 100
country_summary["Recovery_Rate"] = (country_summary["Recovered"] / country_summary["Confirmed"]) * 100
country_summary.head()
13. Heatmap (Correlation)
plt.figure(figsize=(6,4))
sns.heatmap(df[['Confirmed','Deaths','Recovered']].corr(), annot=True)
plt.title("Correlation Between COVID-19 Metrics")
plt.show()
14. Time Series Analysis (Global Trend)
global_daily = df.groupby("Date")[["Confirmed","Deaths","Recovered"]].sum()
plt.figure(figsize=(12,6))
plt.plot(global_daily.index, global_daily["Confirmed"], label="Confirmed")
plt.plot(global_daily.index, global_daily["Deaths"], label="Deaths")
plt.plot(global_daily.index, global_daily["Recovered"], label="Recovered")
plt.legend()
plt.title("Global Trend of COVID-19 Cases Over Time")
plt.xlabel("Date")
plt.ylabel("Cases")
plt.show()
15. Country-Specific Analysis (e.g., India)
india = df[df["Country"]=="India"].groupby("Date")[["Confirmed","Deaths","Recovered"]].sum()
plt.figure(figsize=(10,5))
plt.plot(india.index, india["Confirmed"], label="Confirmed")
plt.plot(india.index, india["Deaths"], label="Deaths")
plt.plot(india.index, india["Recovered"], label="Recovered")
plt.title("COVID-19 Trend in India")
plt.legend()
plt.show()
16. Key Findings (Write in Report)
✔ USA, India, Brazil were most affected
✔ Confirmed cases show exponential growth in early months
✔ High correlation between confirmed cases and deaths
✔ Death rate varies per country (health system differences)
✔ Recovery rate increased after vaccination rollout
✔ India shows rapid growth during second wave
Basic 15 Projects with python
✅ PROJECT 1: Basic Calculator
def add(a, b): return a + b
def sub(a, b): return a - b
def mul(a, b): return a * b
def div(a, b): return a / b
print("1.Add 2.Subtract 3.Multiply 4.Divide")
choice = int(input("Choose: "))
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
if choice == 1: print("Answer:", add(a, b))
elif choice == 2: print("Answer:", sub(a, b))
elif choice == 3: print("Answer:", mul(a, b))
elif choice == 4: print("Answer:", div(a, b))
else: print("Invalid Choice")
✅ PROJECT 2: Number Guessing Game
import random
number = random.randint(1, 10)
while True:
guess = int(input("Guess the number (1–10): "))
if guess == number:
print("Correct! You win.")
break
else:
print("Wrong! Try again.")
✅ PROJECT 3: To-Do List
tasks = []
while True:
print("\n1.Add 2.View 3.Delete 4.Exit")
choice = int(input("Choose: "))
if choice == 1:
tasks.append(input("Enter task: "))
elif choice == 2:
for i, t in enumerate(tasks):
print(i, t)
elif choice == 3:
idx = int(input("Enter index to delete: "))
tasks.pop(idx)
elif choice == 4:
break
✅ PROJECT 4: Student Marks Program
name = input("Enter name: ")
m1 = int(input("Maths: "))
m2 = int(input("Science: "))
m3 = int(input("English: "))
total = m1 + m2 + m3
avg = total / 3
print("Total:", total)
print("Average:", avg)
✅ PROJECT 5: Rock–Paper–Scissors
import random
choices = ["rock", "paper", "scissors"]
user = input("Enter rock/paper/scissors: ").lower()
computer = random.choice(choices)
print("Computer:", computer)
if user == computer:
print("Draw!")
elif (user == "rock" and computer == "scissors") or \
(user == "paper" and computer == "rock") or \
(user == "scissors" and computer == "paper"):
print("You win!")
else:
print("You lose!")
✅ PROJECT 6: Weather Temperature Plot (matplotlib)
import matplotlib.pyplot as plt
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
temp = [30, 32, 31, 29, 35, 36, 34]
plt.plot(days, temp, marker='o')
plt.xlabel("Days")
plt.ylabel("Temperature")
plt.title("Weekly Temperature")
plt.show()
✅ PROJECT 7: Contact Book
contacts = {}
while True:
print("\n1.Add 2.Search 3.View All 4.Exit")
c = int(input("Choose: "))
if c == 1:
name = input("Name: ")
phone = input("Phone: ")
contacts[name] = phone
elif c == 2:
n = input("Search name: ")
print("Phone:", contacts.get(n, "Not found"))
elif c == 3:
print(contacts)
else:
break
✅ PROJECT 8: Quiz Game
questions = {
"Capital of India?": "Delhi",
"5 + 7 = ?": "12",
"National animal of India?": "Tiger"
}
score = 0
for q, ans in questions.items():
if input(q + " ") == ans:
score += 1
print("Score:", score)
✅ PROJECT 9: Digital Clock (Tkinter)
import tkinter as tk
import time
root = tk.Tk()
root.title("Digital Clock")
label = tk.Label(root, font=("Arial", 40), fg="blue")
label.pack()
def update():
label.config(text=time.strftime("%H:%M:%S"))
label.after(1000, update)
update()
root.mainloop()
✅ PROJECT 10: Password Generator
import random
import string
length = int(input("Password length: "))
chars = string.ascii_letters + string.digits + string.punctuation
password = "".join(random.choice(chars) for _ in range(length))
print("Password:", password)
✅ PROJECT 11: Student Result Dashboard (pandas + matplotlib)
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({
"Name": ["A", "B", "C", "D"],
"Marks": [78, 85, 90, 70]
})
print(df)
plt.bar(df["Name"], df["Marks"])
plt.title("Student Marks")
plt.show()
✅ PROJECT 12: Sales Excel Analysis
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_excel("sales.xlsx")
plt.plot(df["Month"], df["Sales"], marker='o')
plt.title("Monthly Sales Trend")
plt.show()
✅ PROJECT 13: Expense Tracker
expenses = []
while True:
print("\n1.Add Expense 2.View Expenses 3.Total 4.Exit")
c = int(input("Choose: "))
if c == 1:
amt = float(input("Amount: "))
desc = input("Description: ")
expenses.append((amt, desc))
elif c == 2:
print(expenses)
elif c == 3:
print("Total:", sum(x[0] for x in expenses))
else:
break
✅ PROJECT 14: Simple Chatbot
while True:
user = input("You: ")
if "hi" in user.lower():
print("Bot: Hello!")
elif "name" in user.lower():
print("Bot: I am ChatBot.")
elif "bye" in user.lower():
print("Bot: Goodbye!")
break
else:
print("Bot: I don't understand.")
✅ PROJECT 15: Sine Wave Plot
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.title("Sine Wave")
plt.xlabel("x")
plt.ylabel("sin(x)")
plt.grid(True)
plt.show()
π― Projects with Python
π― 1. Temperature Chart Project
✔ Goal
Plot daily temperatures for one week.
✔ Code
import matplotlib.pyplot as plt
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
temp = [30, 32, 31, 29, 35, 36, 34]
plt.figure(figsize=(8, 4))
plt.plot(days, temp, marker='o')
plt.title("Weekly Temperature Chart")
plt.xlabel("Days")
plt.ylabel("Temperature (°C)")
plt.grid(True)
plt.show()
π― 2. Student Marks Bar Chart
✔ Goal
Show marks of 5 students using a bar graph.
✔ Code
import matplotlib.pyplot as plt
students = ["A", "B", "C", "D", "E"]
marks = [78, 85, 90, 70, 88]
plt.figure(figsize=(8, 4))
plt.bar(students, marks)
plt.title("Student Marks Comparison")
plt.xlabel("Students")
plt.ylabel("Marks")
plt.show()
π― 3. Pie Chart of Mobile Brands Market Share
✔ Goal
Display percentage of mobile brands.
✔ Code
import matplotlib.pyplot as plt
brands = ["Samsung", "Apple", "Xiaomi", "OnePlus"]
share = [30, 25, 20, 25]
plt.figure(figsize=(6, 6))
plt.pie(share, labels=brands, autopct="%1.1f%%")
plt.title("Mobile Market Share")
plt.show()
π― 4. Line Chart of Monthly Expenses
✔ Goal
Visualize how personal monthly expenses change.
✔ Code
import matplotlib.pyplot as plt
months = ["Jan","Feb","Mar","Apr","May","Jun"]
expense = [12000, 14000, 13000, 15000, 16000, 15500]
plt.figure(figsize=(10,4))
plt.plot(months, expense, marker='o')
plt.title("Monthly Expense Trend")
plt.xlabel("Months")
plt.ylabel("Expense (INR)")
plt.grid(True)
plt.show()
π― 5. Scatter Plot for Study Hours vs Marks
✔ Goal
Show if more study hours leads to more marks.
✔ Code
import matplotlib.pyplot as plt
study_hours = [1, 2, 3, 4, 5, 6, 7]
marks = [50, 55, 60, 65, 70, 80, 90]
plt.figure(figsize=(7,5))
plt.scatter(study_hours, marks)
plt.title("Study Hours vs Marks")
plt.xlabel("Study Hours")
plt.ylabel("Marks")
plt.show()
π― 6. Project: Sales Analysis Chart
✔ Goal
Plot sales data for 6 months.
✔ Code
import matplotlib.pyplot as plt
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
sales = [10000, 12000, 15000, 14000, 17000, 18000]
plt.figure(figsize=(9,4))
plt.bar(months, sales)
plt.title("Monthly Sales Analysis")
plt.xlabel("Months")
plt.ylabel("Sales Amount")
plt.show()
π― 7. Histogram of Student Ages
✔ Goal
Plot distribution of ages.
✔ Code
import matplotlib.pyplot as plt
ages = [17,18,18,19,19,20,17,18,21,22,19,18]
plt.figure(figsize=(7,4))
plt.hist(ages, bins=5)
plt.title("Age Distribution of Students")
plt.xlabel("Age")
plt.ylabel("Frequency")
plt.show()
π― 8. Covid Cases Visualization
✔ Goal
Plot daily covid cases trend.
✔ Code
import matplotlib.pyplot as plt
days = [1,2,3,4,5,6,7]
cases = [100, 150, 200, 180, 220, 300, 350]
plt.figure(figsize=(10,4))
plt.plot(days, cases, marker='o')
plt.title("COVID-19 Cases Trend")
plt.xlabel("Day")
plt.ylabel("Cases")
plt.grid(True)
plt.show()
π― 9. Simple Sine Wave Plot
✔ Goal
Plot a mathematical sine wave.
✔ Code
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(8,4))
plt.plot(x, y)
plt.title("Sine Wave")
plt.xlabel("X")
plt.ylabel("sin(x)")
plt.grid(True)
plt.show()
π― 10. Budget Tracker Bar + Line Mix
✔ Goal
Show income vs expenses together.
✔ Code
import matplotlib.pyplot as plt
months = ["Jan","Feb","Mar","Apr"]
income = [30000, 35000, 32000, 37000]
expense = [20000, 25000, 26000, 28000]
plt.figure(figsize=(10,5))
plt.bar(months, income)
plt.plot(months, expense, marker='o')
plt.title("Income & Expense Comparison")
plt.xlabel("Months")
plt.ylabel("Amount (INR)")
plt.show()
Machine Learning with Python : Scratch to Advanced
https://claude.ai/public/artifacts/d515bb8c-40dd-4d9a-9010-beb96f6aa4e5
-
Basic Python Viva Questions 1. What is Python? Python is a high-level, interpreted, and object-oriented programming language used for w...
-
π― Project 1: Student Marks Data Analysis + Bar Chart Step 1: Create DataFrame import pandas as pd import matplotlib.pyplot as plt ...
-
π― 1. Temperature Chart Project ✔ Goal Plot daily temperatures for one week. ✔ Code import matplotlib.pyplot as plt days = [ "...