+ 1
What the problem in this code can anyone tell please đ
# Asks the user to enter the savings savings = input() # Convert the user input into a float value and update the variable savings = float() # Savings grow after 1 year at a 5% annual interest rate balance = savings * 1.05 # Convert the balance into a string and update the variable balance = str() # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " + balance # Display the message print(message)
2 RĂ©ponses
+ 9
Hints: (check your code again try to update your mistakes).
â Did you convert savings to float and included savings to your function?
â Did you convert the balance string properly?
0
Just script like this đ
# Ask the user to enter the savings and convert it to a float
savings = float(input("Enter your savings: "))
# Calculate the savings after 1 year at a 5% annual interest rate
balance = savings * 1.05
# Convert the balance into a string
balance = str(balance)
# Concatenate the strings to produce a message
message = "Amount in 1 year: " + balance
# Display the message
print(message)