diff --git a/Day1_calculator.py b/Day1_calculator.py new file mode 100644 index 000000000..e73493ec7 --- /dev/null +++ b/Day1_calculator.py @@ -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}") \ No newline at end of file diff --git a/NDV_code_by_Vasanthi_StudentRecord/Day1_calculator.py b/NDV_code_by_Vasanthi_StudentRecord/Day1_calculator.py new file mode 100644 index 000000000..e73493ec7 --- /dev/null +++ b/NDV_code_by_Vasanthi_StudentRecord/Day1_calculator.py @@ -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}") \ No newline at end of file diff --git a/NDV_code_by_Vasanthi_StudentRecord/README.md b/NDV_code_by_Vasanthi_StudentRecord/README.md new file mode 100644 index 000000000..d458dd0ff --- /dev/null +++ b/NDV_code_by_Vasanthi_StudentRecord/README.md @@ -0,0 +1 @@ +This folder contains student record files. diff --git a/NDV_code_by_Vasanthi_StudentRecord/StudentRecordManagement.py b/NDV_code_by_Vasanthi_StudentRecord/StudentRecordManagement.py new file mode 100644 index 000000000..a97879f42 --- /dev/null +++ b/NDV_code_by_Vasanthi_StudentRecord/StudentRecordManagement.py @@ -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() diff --git a/NDV_code_by_Vasanthi_StudentRecord/students.json b/NDV_code_by_Vasanthi_StudentRecord/students.json new file mode 100644 index 000000000..39e59f813 --- /dev/null +++ b/NDV_code_by_Vasanthi_StudentRecord/students.json @@ -0,0 +1,9 @@ +[ + { + "Student ID": "130", + "Name": "Yash", + "Branch": "AI & ML", + "Year": "2020", + "Marks": 986.0 + } +] \ No newline at end of file diff --git a/NDV_code_by_Vasanthi_StudentRecord/tax_calculator.py b/NDV_code_by_Vasanthi_StudentRecord/tax_calculator.py new file mode 100644 index 000000000..c632f1712 --- /dev/null +++ b/NDV_code_by_Vasanthi_StudentRecord/tax_calculator.py @@ -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() diff --git a/StudentRecordManagement.py b/StudentRecordManagement.py new file mode 100644 index 000000000..a97879f42 --- /dev/null +++ b/StudentRecordManagement.py @@ -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() diff --git a/students.json b/students.json new file mode 100644 index 000000000..39e59f813 --- /dev/null +++ b/students.json @@ -0,0 +1,9 @@ +[ + { + "Student ID": "130", + "Name": "Yash", + "Branch": "AI & ML", + "Year": "2020", + "Marks": 986.0 + } +] \ No newline at end of file diff --git a/tax_calculator.py b/tax_calculator.py new file mode 100644 index 000000000..c632f1712 --- /dev/null +++ b/tax_calculator.py @@ -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()