Answer the question
In order to leave comments, you need to log in
How to multiply a number by a percentage in Python?
There is a task # (while loop)
# The student's monthly stipend is educational_grant roubles, and living expenses exceed the stipend
# and amount to expenses roubles. per month. Rising prices increase costs by 3% every month, except for the first month
# Program to calculate the amount of money you need to ask your parents at a time
# so that you can live through the school year (10 months) using only this money and a scholarship.
# Output format:
# The student should ask for XXXX.XX rubles
How to solve the problem?
Answer the question
In order to leave comments, you need to log in
taking into account the comment by Sergey K , provided that you need to indicate how much money he will ask for at once:
educational_grant = float(input("Введите месячную стипендию: ")) # месячная стипуха
expenses = float(input("Введите месячный расход: ")) # расходы в месяц
i = 0
delta = 0
while i < 9:
delta += educational_grant - (expenses + (expenses) * 0.03 * i) # на первой итерации при i = 0, повышения цен аффектит значение
i += 1
if delta < 0:
print(f'нужно просить {-delta} на учебный год')
else:
print('денег просить не надо, может еще и останется')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question