Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Day1_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Calculator
num1=int(input())
num2=int(input())
sum=num1+num2
print(f"Sum of {num1} and {num2} is {sum}")
diff=num1-num2
print(f"Difference of {num1} and {num2} is {diff}")
mul=num1*num2
print(f"Multiplication of {num1} and {num2} is {mul}")
div=num1/num2
print(f"Division of {num1} and {num2} is {div}")
mod=num1%num2
print(f"Modulus of {num1} and {num2} is {mod}")
13 changes: 13 additions & 0 deletions NDV_code_by_Vasanthi_StudentRecord/Day1_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Calculator
num1=int(input())
num2=int(input())
sum=num1+num2
print(f"Sum of {num1} and {num2} is {sum}")
diff=num1-num2
print(f"Difference of {num1} and {num2} is {diff}")
mul=num1*num2
print(f"Multiplication of {num1} and {num2} is {mul}")
div=num1/num2
print(f"Division of {num1} and {num2} is {div}")
mod=num1%num2
print(f"Modulus of {num1} and {num2} is {mod}")
1 change: 1 addition & 0 deletions NDV_code_by_Vasanthi_StudentRecord/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains student record files.
112 changes: 112 additions & 0 deletions NDV_code_by_Vasanthi_StudentRecord/StudentRecordManagement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import json
import os

DATA_FILE = "students.json"

class Student:
def __init__(self, student_id, name, branch, year, marks):
self.student_id = student_id
self.name = name
self.branch = branch
self.year = year
self.marks = marks

def to_dict(self):
return {
"Student ID": self.student_id,
"Name": self.name,
"Branch": self.branch,
"Year": self.year,
"Marks": self.marks
}

class StudentManager:
def __init__(self):
self.students = []
self.load_data()

def load_data(self):
if os.path.exists(DATA_FILE):
with open(DATA_FILE, "r") as file:
data = json.load(file)
for item in data:
self.students.append(Student(**item))

def save_data(self):
with open(DATA_FILE, "w") as file:
json.dump([s.to_dict() for s in self.students], file, indent=4)

def add_student(self):
student_id = input("Enter Student ID: ")
name = input("Enter Name: ")
branch = input("Enter Branch: ")
year = input("Enter Year: ")
marks = float(input("Enter Marks: "))
student = Student(student_id, name, branch, year, marks)
self.students.append(student)
self.save_data()
print("✅ Student added successfully.")

def view_students(self):
if not self.students:
print("No student records found.")
return

print("\n{:<12} {:<15} {:<10} {:<6} {:<6}".format("Student ID", "Name", "Branch", "Year", "Marks"))
print("-" * 55)
for s in self.students:
print("{:<12} {:<15} {:<10} {:<6} {:<6}".format(
s.student_id, s.name, s.branch, s.year, s.marks))

def update_student(self):
student_id = input("Enter Student ID to update: ")
for s in self.students:
if s.student_id == student_id:
s.name = input("Enter new Name: ")
s.branch = input("Enter new Branch: ")
s.year = input("Enter new Year: ")
s.marks = float(input("Enter new Marks: "))
self.save_data()
print("✅ Student record updated.")
return
print("❌ Student not found.")

def delete_student(self):
student_id = input("Enter Student ID to delete: ")
for s in self.students:
if s.student_id == student_id:
self.students.remove(s)
self.save_data()
print("✅ Student record deleted.")
return
print("❌ Student not found.")

def main():
manager = StudentManager()

while True:
print("\n=== Student Record Management ===")
print("1. Add Student")
print("2. View All Students")
print("3. Update Student")
print("4. Delete Student")
print("5. Exit")

choice = input("Enter your choice: ")

if choice == "1":
manager.add_student()
elif choice == "2":
manager.view_students()
elif choice == "3":
manager.update_student()
elif choice == "4":
manager.delete_student()
elif choice == "5":
print("Exiting... 👋")
break
else:
print("❌ Invalid choice. Try again.")

if __name__ == "__main__":
main()
9 changes: 9 additions & 0 deletions NDV_code_by_Vasanthi_StudentRecord/students.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"Student ID": "130",
"Name": "Yash",
"Branch": "AI & ML",
"Year": "2020",
"Marks": 986.0
}
]
82 changes: 82 additions & 0 deletions NDV_code_by_Vasanthi_StudentRecord/tax_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
def calculate_old_regime_tax(gross_income, hra_claimed, sec_80c=150000, std_deduction=50000):
# Total deductions allowed under old regime
total_deductions = std_deduction + sec_80c + hra_claimed
taxable_income = gross_income - total_deductions
tax = 0

# Old regime tax slabs
if taxable_income <= 250000:
tax = 0
elif taxable_income <= 500000:
tax = (taxable_income - 250000) * 0.05
elif taxable_income <= 1000000:
tax = (250000 * 0.05) + (taxable_income - 500000) * 0.20
else:
tax = (250000 * 0.05) + (500000 * 0.20) + (taxable_income - 1000000) * 0.30

# Rebate under section 87A
if taxable_income <= 500000:
tax = 0

return max(0, tax), max(0, taxable_income)


def calculate_new_regime_tax(income):
tax = 0

# New regime tax slabs
if income <= 300000:
tax = 0
elif income <= 600000:
tax = (income - 300000) * 0.05
elif income <= 900000:
tax = (300000 * 0.05) + (income - 600000) * 0.10
elif income <= 1200000:
tax = (300000 * 0.05) + (300000 * 0.10) + (income - 900000) * 0.15
elif income <= 1500000:
tax = (300000 * 0.05) + (300000 * 0.10) + (300000 * 0.15) + (income - 1200000) * 0.20
else:
tax = (300000 * 0.05) + (300000 * 0.10) + (300000 * 0.15) + (300000 * 0.20) + (income - 1500000) * 0.30

# Rebate under section 87A
if income <= 700000:
tax = 0

return max(0, tax)


def main():
print("=== Income Tax Calculator: Old vs New Regime ===")

try:
ctc = float(input("Enter your Annual CTC (₹): "))
bonus = float(input("Enter your Annual Bonus (₹): "))
hra = float(input("Enter your HRA claimed under Old Regime (₹): "))
except ValueError:
print("❌ Invalid input. Please enter numbers only.")
return

# Step 1: Calculate gross income
gross_income = ctc + bonus
print(f"\nTotal Income including Bonus = ₹{gross_income:,.2f}")

# Step 2: Calculate taxes under both regimes
old_tax, old_taxable_income = calculate_old_regime_tax(gross_income, hra)
new_tax = calculate_new_regime_tax(gross_income)

# Step 3: Display comparison
print("\n--- Tax Calculation Summary ---")
print(f"Taxable Income under Old Regime: ₹{old_taxable_income:,.2f}")
print(f"Tax under Old Regime: ₹{old_tax:,.2f}")
print(f"Tax under New Regime: ₹{new_tax:,.2f}")

print("\n--- Comparison Summary ---")
if old_tax < new_tax:
print("✅ Old Regime is better. You save more tax.")
elif new_tax < old_tax:
print("✅ New Regime is better. You save more tax.")
else:
print("⚖️ Both regimes result in the same tax.")

if __name__ == "__main__":
main()
112 changes: 112 additions & 0 deletions StudentRecordManagement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import json
import os

DATA_FILE = "students.json"

class Student:
def __init__(self, student_id, name, branch, year, marks):
self.student_id = student_id
self.name = name
self.branch = branch
self.year = year
self.marks = marks

def to_dict(self):
return {
"Student ID": self.student_id,
"Name": self.name,
"Branch": self.branch,
"Year": self.year,
"Marks": self.marks
}

class StudentManager:
def __init__(self):
self.students = []
self.load_data()

def load_data(self):
if os.path.exists(DATA_FILE):
with open(DATA_FILE, "r") as file:
data = json.load(file)
for item in data:
self.students.append(Student(**item))

def save_data(self):
with open(DATA_FILE, "w") as file:
json.dump([s.to_dict() for s in self.students], file, indent=4)

def add_student(self):
student_id = input("Enter Student ID: ")
name = input("Enter Name: ")
branch = input("Enter Branch: ")
year = input("Enter Year: ")
marks = float(input("Enter Marks: "))
student = Student(student_id, name, branch, year, marks)
self.students.append(student)
self.save_data()
print("✅ Student added successfully.")

def view_students(self):
if not self.students:
print("No student records found.")
return

print("\n{:<12} {:<15} {:<10} {:<6} {:<6}".format("Student ID", "Name", "Branch", "Year", "Marks"))
print("-" * 55)
for s in self.students:
print("{:<12} {:<15} {:<10} {:<6} {:<6}".format(
s.student_id, s.name, s.branch, s.year, s.marks))

def update_student(self):
student_id = input("Enter Student ID to update: ")
for s in self.students:
if s.student_id == student_id:
s.name = input("Enter new Name: ")
s.branch = input("Enter new Branch: ")
s.year = input("Enter new Year: ")
s.marks = float(input("Enter new Marks: "))
self.save_data()
print("✅ Student record updated.")
return
print("❌ Student not found.")

def delete_student(self):
student_id = input("Enter Student ID to delete: ")
for s in self.students:
if s.student_id == student_id:
self.students.remove(s)
self.save_data()
print("✅ Student record deleted.")
return
print("❌ Student not found.")

def main():
manager = StudentManager()

while True:
print("\n=== Student Record Management ===")
print("1. Add Student")
print("2. View All Students")
print("3. Update Student")
print("4. Delete Student")
print("5. Exit")

choice = input("Enter your choice: ")

if choice == "1":
manager.add_student()
elif choice == "2":
manager.view_students()
elif choice == "3":
manager.update_student()
elif choice == "4":
manager.delete_student()
elif choice == "5":
print("Exiting... 👋")
break
else:
print("❌ Invalid choice. Try again.")

if __name__ == "__main__":
main()
9 changes: 9 additions & 0 deletions students.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"Student ID": "130",
"Name": "Yash",
"Branch": "AI & ML",
"Year": "2020",
"Marks": 986.0
}
]
Loading