H
H
h4ckurman2021-06-24 18:17:36
Python
h4ckurman, 2021-06-24 18:17:36

Help with the solution of the problem taken from the book Getting Started Programming in Python | Gaddis Tony?

I want to check the correctness of my code
The task itself:
60d4a16a44fe5851519224.png

My code:

purchase_amount = int(input('Введите величину вашей покупки: '))
FEDERAL_TAX = 0.005 * purchase_amount
REGIONAL_TAX = 0.025 * purchase_amount
ALL_TAX = FEDERAL_TAX + REGIONAL_TAX
print("Ваша сумма покупки составляет:",purchase_amount)
print('Федеральный налог с продаж составляет:',FEDERAL_TAX)
print('Региональный налог с продаж составляет:',REGIONAL_TAX)
print('Общий налог с продаж составляет:',ALL_TAX)
print('Общая сумма продаж составляет:', purchase_amount+ALL_TAX)


Please check if my implementation is correct. Do not judge strictly, I'm still learning :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Shavaleev, 2021-06-24
@h4ckurman

In general, everything seems to be correct, the only thing was a typo with the calculation of the federal tax, you have it 0.005, when it should be 0.05

M
mkone112, 2021-06-24
@mkone112

Are you going to drag here every 10 lines? Maybe read it first?
PS You need to start with Lutz.
PPS

print(
    f"Ваша сумма покупки составляет:{purchase_amount}",
    f"Федеральный налог с продаж составляет:{FEDERAL_TAX}",
    f"Региональный налог с продаж составляет:{REGIONAL_TAX}",
    f"Общий налог с продаж составляет:{ALL_TAX}",
    f"Общая сумма продаж составляет:{PURCHASE_WITH_TAX}",
    sep='\n'
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question