Question
Scenario Once upon a time there was a land - a land of milk and honey, inhabited by happy and prosperous people. The people paid
-
Scenario
Once upon a time there was a land - a land of milk and honey, inhabited by happy and prosperous people. The people paid taxes, of course - their happiness had limits. The most important tax, called the Personal Income Tax (PIT for short) had to be paid once a year, and was evaluated using the following rule:
-
if the citizen's income was not higher than 85,528 thalers, the tax was equal to 18% of the income minus 556 thalers and 2 cents (this was the so-called tax relief)
-
if the income was higher than this amount, the tax was equal to 14,839 thalers and 2 cents, plus 32% of the surplus over 85,528 thalers.
Your task is to write a tax calculator.
-
It should accept one floating-point value: the income.
-
Next, it should print the calculated tax, rounded to full thalers. There's a function named
round() which will do the rounding for you - you'll find it in the skeleton code in the editor.
Note: this happy country never returns money to its citizens. If the calculated tax is less than zero, it only means no tax at all (the tax is equal to zero). Take this into consideration during your calculations.
Sample Code: income = float(input("Enter the annual income: "))
# # Put your code here. #
tax = round(tax, 0) print("The tax is:", tax, "thalers")
Assignment 2 if .. elif .. else Objective Familiarize the student with:
-
using the if-elif-else statement;
-
finding the proper implementation of verbally defined rules;
-
testing code using sample input and output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started