+ 1
Where did mess up....
I'm not getting what it wants me to do.. # Asks the user to enter the savings savings = input("Enter your savings:") # Convert the user input into a float value and update the variable savings = float(input("Enter your savings:")) # 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(balance) # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " + balance # Display the message print(message) Pls help..
4 Respuestas
+ 2
In the second line of code, you need to write savings=float(savings) instead of savings=float(input()).
+ 5
Did the task come with the text "enter your savings", or did you add that?
Look closely at your 2nd line of coding (ignoring comments). Do you need input 2x? *hint: maybe that's the line to change
+ 2
Thanks..
I was writing it 2 times..
This is the correct code according to the question
# Asks the user to enter the savings
savings = input()
# Convert the user input into a float value and update the variable
savings = float(savings)
# 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(balance)
# Concatenate the 2 strings to produce a message
message = "Amount in 1 year: " + balance
# Display the message
print(message)
0
# Ask the user to enter savings (only once) and convert to float
savings = float(input("Enter your savings: "))
# Calculate balance after 1 year with 5% interest
balance = savings * 1.05
# Round to 2 decimal places (if needed for currency)
balance = round(balance, 2)
# Convert to string for concatenation
balance_str = str(balance)
# Construct and print the message
message = "Amount in 1 year: " + balance_str
print(message)