Нужна помощь как запустить всё по отдельности? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Нужна помощь как запустить всё по отдельности?

# Просит пользователя ввести сумму сбережений savings = input() # Преобразует ввод пользователя в значение с плавающей запятой и обновляет переменную savings = float() # Сбережения растут через 1 год под 5% годовой процентной ставкой balance = savings * 1.05 # Преобразует баланс в строку и обновляет переменную balance = str(150 * 1.05); balance1 = str(200 * 1.05); balance2 = str(1000 * 1.05); # Объединяет 2 строки, чтобы получить сообщение message = "Amount in 1 year: " + balance message1 = "Amount in 1 year: " + balance1 message2 = "Amount in 1 year: " + balance2 # Отобразите сообщение print(message) print(message1) print(message2)

15th Dec 2023, 4:33 PM
ALIAKSEI DANILIUK
ALIAKSEI DANILIUK - avatar
3 Answers
+ 3
savings = float(input()) balance = savings * 1.05 message = "Amount in 1 year: " + str(balance) print(message)
15th Dec 2023, 4:59 PM
ALIAKSEI DANILIUK
ALIAKSEI DANILIUK - avatar
+ 3
Алексей here is the corrected way to convert savings into a float from the input string: savings = input() savings = float(savings) Or in a single line, you can get input and convert it all at once: savings = float(input()) Now you may remove the hard-coded calculations for balance, balance1, and balance2.
15th Dec 2023, 4:41 PM
Brian
Brian - avatar
+ 1
thank you my friend👍
15th Dec 2023, 4:59 PM
ALIAKSEI DANILIUK
ALIAKSEI DANILIUK - avatar