What the problem in this code can anyone tell please 😭 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)

14th Sep 2023, 3:22 AM
Atul Pal
Atul Pal - avatar
2 Answers
+ 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?
14th Sep 2023, 3:52 AM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
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)
15th Sep 2023, 12:00 AM
Nadzi