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
62 changes: 62 additions & 0 deletions ndvcode_by_RoopeshR_TaxCalculator/taxcalculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
print("==== TAX DEDUCTION CALCULATOR ====")

# Input
ctc = float(input("Enter your CTC (₹): "))
bonus = float(input("Enter your Bonus (₹): "))

# Total income
total_income = ctc + bonus
print("Total Income (CTC + Bonus): ₹", total_income)

# ---- Old Regime ----
# Standard deduction
standard_deduction = 50000
hra = 20000
sec_80c = 150000 # Maximum under Section 80C

# Total deductions under old regime
total_deductions_old = standard_deduction + hra + sec_80c
taxable_income_old = total_income - total_deductions_old

# Calculate old regime tax
if taxable_income_old <= 250000:
old_tax = 0
elif taxable_income_old <= 500000:
old_tax = (taxable_income_old - 250000) * 0.05
elif taxable_income_old <= 1000000:
old_tax = (250000 * 0.05) + (taxable_income_old - 500000) * 0.20
else:
old_tax = (250000 * 0.05) + (500000 * 0.20) + (taxable_income_old - 1000000) * 0.30

old_tax += old_tax * 0.04 # 4% cess

# ---- New Regime ----
taxable_income_new = total_income

# Calculate new regime tax
if taxable_income_new <= 300000:
new_tax = 0
elif taxable_income_new <= 600000:
new_tax = (taxable_income_new - 300000) * 0.05
elif taxable_income_new <= 900000:
new_tax = (300000 * 0.05) + (taxable_income_new - 600000) * 0.10
elif taxable_income_new <= 1200000:
new_tax = (300000 * 0.05) + (300000 * 0.10) + (taxable_income_new - 900000) * 0.15
elif taxable_income_new <= 1500000:
new_tax = (300000 * 0.05) + (300000 * 0.10) + (300000 * 0.15) + (taxable_income_new - 1200000) * 0.20
else:
new_tax = (300000 * 0.05) + (300000 * 0.10) + (300000 * 0.15) + (300000 * 0.20) + (taxable_income_new - 1500000) * 0.30

new_tax += new_tax * 0.04 # 4% cess

# Output
print("Old Regime Tax Deduction: ₹", round(old_tax))
print("New Regime Tax Deduction: ₹", round(new_tax))

# Comparison
if old_tax < new_tax:
print("You save ₹", round(new_tax - old_tax), "more using the Old Regime.")
elif new_tax < old_tax:
print("You save ₹", round(old_tax - new_tax), "more using the New Regime.")
else:
print("Both regimes give the same tax. Choose either.")
126 changes: 126 additions & 0 deletions ndvcode_by_roopeshR_Studentrecord/Studentrercord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import json
import os

class Student:
def __init__(self, name, rollno, marks, course):
self.name = name
self.rollno = rollno
self.marks = marks
self.course = course

def to_dict(self):
return {
"name": self.name,
"rollno": self.rollno,
"marks": self.marks,
"course": self.course
}


FILE_NAME="students.json"

def load_students():
if not os.path.exists(FILE_NAME):
return[]
with open(FILE_NAME,"r") as file:
return json.load(file)

def save_students(students):
with open(FILE_NAME,"w") as file:
json.dump(students,file,indent=4)

def add_students():
rollno = int(input("Enter the Roll No: "))
name = input("Enter your Name: ")
course = input("Enter your Course: ")
marks = float(input("Enter your Marks: "))

student_obj = Student(name, rollno, marks, course)
student_list = load_students()
student_list.append(student_obj.to_dict())
save_students(student_list)
print("Student added successfully.")

def display_students():
students = load_students()
if not students: # This checks if the list is empty
print("No students data found.")
return
for s in students:
print(f"\nRoll no: {s['rollno']}")
print(f"Name: {s['name']}")
print(f"Marks: {s['marks']}")
print(f"Course: {s['course']}")
print("-" * 30)

def search_students():
roll = int(input("Enter roll no to search: ")) # Corrected this line
students = load_students()
for s in students:
if s['rollno'] == roll:
print("\nStudent found")
print(f"Name: {s['name']}")
print(f"Marks: {s['marks']}")
print(f"Course: {s['course']}")
return
print("Student not found")

def delete_students():
try:
roll = int(input("Enter the roll no to delete: "))
except ValueError:
print("Invalid roll number. Please enter a valid integer.")
return

students = load_students()
updated = [s for s in students if s['rollno'] != roll]
if len(students) == len(updated):
print("Student not found.")
else:
save_students(updated)
print("Student deleted successfully.")

def update_students():
roll = int(input("enter roll no to update: "))
students=load_students()
for s in students:
if s['rollno']== roll:
print("current details")
print("name: {s['name']},course:{s['course']} , marks:{s['marks']}")
s['name']=input("enter new name")
s['course']=input("enter the course")
s['marks']=float(input("enter new marks:"))
save_students(students)
print("student updated successfully")
return
print("students not found")

def menu():
while True:
print("\n ---students record management---")
print("1. add students")
print("2. display all students")
print("3. search students")
print("4. delete student")
print("5. update students")
print("0.exit")

choice=int(input("enter your choice: "))

if choice ==1:
add_students()
elif choice== 2:
display_students()
elif choice== 3:
search_students()
elif choice == 4:
delete_students()
elif choice == 5:
update_students()
elif choice == 0:
print("exiting program")
break
else:
print("invalid choice")
if __name__ == '__main__':
menu()