+ 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
12 odpowiedzi
+ 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 ...
+ 2
Wadu LuckyEmma Please show us your attempt and more details as to what the code project that you are attempting.
+ 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
+ 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)
+ 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)
+ 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)}")
+ 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
0
Yeah I get it but there's still something bro I wish i can take for u screen shot
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
0
I wish u could understand what I'm trying to mean
0
Okay let me first do that
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🙏