0
Not able to crack
# Asks the user to enter the savings savings = input(150) # 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 ) https://code.sololearn.com/c7L8M6D6GigY/?ref=app https://code.sololearn.com/c7L8M6D6GigY/?ref=app https://code.sololearn.com/c7L8M6D6GigY/?ref=app
2 Réponses
+ 8
Vansh Vardhan Shrivas ,
it is only a small issue that causes the problem:
savings = input(150)
... ^^^^
this uses a user prompt inside the parenthesis, which is printing the nunber *150*. this is seen as a not required output.
> remove the number in the input() function to get the code running.
+ 6
Vansh Vardhan Shrivas also there is no need to enter an input as a string then convert it to a float. Simply begin with
savings = float(input() or 150)
The same for balance to a str
balance = str(savings * 1.05)