Hey!......I am currently learning python and i am stuck at one step.It's the finance app practice level.Plz can anyone help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hey!......I am currently learning python and i am stuck at one step.It's the finance app practice level.Plz can anyone help me?

I am not a pro learner so that's why i cannot use ai.I can't understand the code and i don't even know is it telling me to do.It's the "Introduction to python"course. Following is the task: You are developing a finance app that helps users to grow their savings. Task Complete the code to take the savings, calculate the end amount, then display a message on the screen. (I will also write the code that was already written on the screen) # Asks the user to enter the savings savings = input() # Convert the user input into a float value and update the variable 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 = # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " balance # Display the message (I can't understand it.So plz help me)

5th Sep 2023, 5:27 AM
Sweet Killer
Sweet Killer - avatar
4 Answers
+ 2
The comments after # are your instructions, follow those one-by-one and you can solve the problem. As a help, here are some hints: 1. To convert to float value, use float() function. For example: 🔹 float(savings) 2. To convert into a string, use str() function. For example: 🔹 str(balance) 3. To concatenate two strings, simple use the + sign. 🔹 "Amount in 1 year: " + balance I think the code is already provided, you just have to identify what's missing in each line and complete it. You can always review the lessons btw. If you have questions, feel free to ask :)
5th Sep 2023, 6:25 AM
noteve
noteve - avatar
+ 2
The str(balance) is not assigned to any variable. You can assign it to a variable to 'update' that particular balance variable. 🔹 balance = savings * 1.05 🔹 balance = str(balance) An alternative way is to convert the balance into str directly in the line where concatenation occurs. 🔹 message = "Amount in 1 year: " + str(balance)
5th Sep 2023, 7:15 AM
noteve
noteve - avatar
+ 2
Thank you so much for your time.I couldn't do this level without you.
6th Sep 2023, 7:02 AM
Sweet Killer
Sweet Killer - avatar
+ 1
I wrote str(balance) in the code but it is still saying that balance is a float convert it into string I'll share the code # 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 str(balance) # Convert the balance into a string and update the variable balance = savings * 1.05 str(balance) # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " + balance # Display the message I wrote what you said but it's still not working.Please guide me.
5th Sep 2023, 7:06 AM
Sweet Killer
Sweet Killer - avatar