7 months ago
3.5 kB
import random
from tabulate import tabulate
name = input("Enter your name: ")
tot_income, expenditure, c1, g, e, tx, msc2, vech2, hlth1, savigs1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
y = int(input("Enter your age: "))
primary_income = int(input("Enter your primary income value: "))
secondary_income = 0
a = input("Do you have any secondary source of income? Enter y/n: ").lower()
if a == "y":
    secondary_income = int(input("Enter value of secondary source of income: "))
tot_income = primary_income + secondary_income

c = input("Do you have any children? Enter y/n: ").lower()
if c == "y":
    c1 = int(input("Enter the yearly education fees for your child/children: "))

d = input("Do you own any properties? Enter y/n: ").lower()
if d == "y":
    e = int(input("Enter the combined maintenance cost of your properties: "))
    tx = int(input("Enter the tax you're paying for the properties you own: "))
    expenditure = e + tx
    f = input("Do you have any properties for rent or for use that's being accommodated for? Enter y/n: ").lower()
    if f == "y":
        g = int(input("Enter income earned from properties: "))

msc = input("Do you have any miscellaneous expenses like ongoing subscriptions like music, television, newspaper services? Enter y/n: ").lower()
if msc == "y":
    msc2 = int(input("Enter average money used for miscellaneous costs: "))

vech = input("Do you possess any vehicles? Enter y/n: ").lower()
if vech == "y":
    vech2 = int(input("Enter the cost of services required to maintain the vehicles: "))
    insura = input("Have the insurance papers for your vehicles been renewed? Enter y/n: ").lower()
    if insura == "n":
        print("Kindly renew your insurance papers as it is required according to the law")

hlth = input("Do you have any medical conditions that require prescribed medication or regular(periodic) visits to a consultant? Enter y/n: ").lower()
if hlth == "y":
    hlth1 = int(input("Enter the money spent for your healthcare: "))

savigs = input("Do you have any savings present in your bank account or possession? Enter y/n: ").lower()
if savigs == "y":
    savigs1 = int(input("Enter the money you have as savings: "))

tot_income = tot_income + g
expenditure_total = c1 + e + tx + msc2 + vech2 + hlth1

l = ["Category", "Amount"]
vm = [["Name", name],["Age", y],["Income", tot_income], ["Education Fees", c1], ["Properties Expenditure", e], ["Income from Properties", g],
      ["Tax Paid for Properties", tx], ["Miscellaneous Expenditure", msc2], ["Vehicle Maintenance", vech2],
      ["Healthcare", hlth1], ["Savings", savigs1]]

print(tabulate(vm, headers=l, tablefmt="grid"))
if cir>45:
    print("Your cost to income ratio is:",cir)
    print("This is a high value, therefore we recommened changing your money allocatement to each field")
    print("We recommend reducing the expenditure by ",exerp,"%")
    print("The money you'll be left with on reducing expenses is ",savnew)
    print("We also recommend you invest ",random.randrange(10,20),"% of your leftover money in saving plans")
    print("Your cost to income ratio is:",cir)
    print("This is an acceptable value")
    print("We would still recommend investing (20-25)% of your income in saving plans")