+ 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 odpowiedzi
+ 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)