Not able to crack | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

16th Jun 2023, 2:25 PM
Vansh Vardhan Shrivas
Vansh Vardhan Shrivas - avatar
2 Answers
+ 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.
16th Jun 2023, 2:42 PM
Lothar
Lothar - avatar
+ 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)
16th Jun 2023, 2:55 PM
BroFar
BroFar - avatar