Output for calculating tax in Python ?


Your problem is create a program ,which will calculate the income tax over item in python.this problem is not new,many people's or students ask it many times.companies also want a calculator which calculate taxes of their employes.
it's not so hard or difficult but just a logical or calculating issues arrise anyway, I will going to explain you how you will create a program of calculating tax in python.

Before we start ,we have to understand the working of the program.

By default,python prints numbers based on their type, e.g. an integer will print as 123 and floating point numbers would print out as 12345.0 or 12345.054.our first work is create  the output , e.g. $ 12,500.


Now second,we have to use arithmetic operations(division and subtraction) to isolate the millions of dollar,thousands of dollars and single dollars and cents of dollars.
In the example , iam showing that you can use 12 thousands,2 million,345 singles or 8 cents.for simplicity, you will just print your value in :-

print("Tax Calculator ...")
print("Enter your price of item : ")
print("Your Tax is calculating...")

Now, create a function as def named tax which have two attribute's price and rate.

def tax(price,rate):
          cal = price+(price*rate)
          total = round(cal,2)
          return total

Here ,In the tax def create cal and total variable's and we have to do some calculations.cal=price+(price*rate) and total=round(cal,2).at last return total. 

At last ,now we have to show tax value on screen.

prim = price+(price,rate)
pr_tax = tax(prim,.0875)
print("The tax is : ",pr_tax)



The tax calculating program in python are :-








print("Tax Calculator ...")
print("Enter your price of item : ")
print("Your Tax is calculating...")

def tax(price,rate):
          cal = price+(price*rate)
          total = round(cal,2)
          return total

prim = price+(price,rate)
pr_tax = tax(prim,.0875)
print("The tax is : ",pr_tax)
Reactions

Post a Comment

0 Comments