+ 1

How to show the answers for Test case#1 and Test case #2 separate

I can finish all my test cases but unfortunately I find all my answer in one row, so how can I separate them So that all y test case #1 to #3 can be ticked

27th Jan 2024, 4:14 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
12 Answers
+ 3
Okay first off Wadu LuckyEmma we won't be hard coding savings as it should be savings = input() So the second line we are converting a string to a float or float(savings) savings = float(savings) Each comment explains what to convert and what to convert to ... Just follow the instructions. * again remember the program request to input data as if the program is the user inputting to test ...
27th Jan 2024, 5:13 AM
BroFar
BroFar - avatar
+ 2
Wadu LuckyEmma Please show us your attempt and more details as to what the code project that you are attempting.
27th Jan 2024, 4:58 AM
BroFar
BroFar - avatar
+ 2
Wadu LuckyEmma when you concat you may need to add a whitespace message = "Amount in 1 year: " <!-- here--> before the second quote " then proceed to + balance
27th Jan 2024, 5:22 AM
BroFar
BroFar - avatar
+ 2
Wadu LuckyEmma this code actually could be written in less than 3 lines but here is the basics for easy learning # Asks the user to enter the savings savings = float(input()) balance = str(savings * 1.05) msg = "Amount in 1 year: " + balance print(msg)
27th Jan 2024, 5:27 AM
BroFar
BroFar - avatar
+ 2
Wadu LuckyEmma let's change the #comment in the code itself # Asks the user to enter the savings Strike the word user to we the people behind the scenes will input the savings amount not you the creator of the code ... savings = float(input()) #-------------------------------------- #your code goes here balance = str(savings * 1.05) msg = "Amount in 1 year: " + balance print(msg)
27th Jan 2024, 5:41 AM
BroFar
BroFar - avatar
+ 2
If you, Wadu LuckyEmma , are referring to converting from one datatype to another by default The input() is a built-in function and a string Converting to a float() which is a built-in function Converting to a string with yet another built-in function str() then concatenation of two strings using a + before using another built-in function to output print() print(f"Amount in 1 year: {str(float(input())*1.05)}")
27th Jan 2024, 5:51 AM
BroFar
BroFar - avatar
+ 1
# Asks the user to enter the savings savings = 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 ) So my question come I have another value I want use for test case #2 and #3 but I don't know how to display them separately
27th Jan 2024, 5:07 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
0
Yeah I get it but there's still something bro I wish i can take for u screen shot
27th Jan 2024, 5:16 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
0
I've got that test case 1 correct but in the results tab. You. Realise that you need to input a mother figure which when I try to do it, it displays all the answers in the output row for test case #1 which corrupts all the work
27th Jan 2024, 5:19 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
0
I wish u could understand what I'm trying to mean
27th Jan 2024, 5:20 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
0
Okay let me first do that
27th Jan 2024, 5:26 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar
0
Yes. But I've other values that I want to input as savings so that my results would display separately but that's what I don't know how to do sir🙏
27th Jan 2024, 5:33 AM
Wadu LuckyEmma
Wadu LuckyEmma - avatar