+ 1

Problem on how solve all Test Cases

Hi all, i'm having some serious trouble to complete a test (the Tip Calculator) with Python. I wrote the code that is necessary to resolve 2 test cases but the third is locked and obscured so i can't know what the input is to resolve it. What is the reason? The strange thing is, if i wrote the code to solve only 1 test case, the system check it and gives me a green pass (on the test case) but if i wrote the code for the first two test cases it check that the results are ok (25.0 and 53.6 like the output expected) but continue to give me a red cross on the 2 test cases and i don't know the reason. Someone have solved this problem?I'm really starting to become crazy for it N.D sorry for my poor english but it isn't my first language

26th Sep 2021, 3:59 PM
Luigi Pietragalla
Luigi Pietragalla - avatar
6 Antworten
+ 2
Plz share your attempt with us So, we can correct you with proper explanation. Coz sololearn community doesn't allow us to give the solution directly.
26th Sep 2021, 4:09 PM
Myo Thuzar
Myo Thuzar - avatar
+ 2
bill = int(input()) #your code goes here Mancia = (bill * 20) / 100 print (Mancia) #Here I modified your code
26th Sep 2021, 4:36 PM
Myo Thuzar
Myo Thuzar - avatar
+ 2
In your first attempt, It will surely pass test 1 Coz the input for test 1 is 125 And you write like (125*20/100) how about the other inputs? If you write like that , whatever the input we put , output will always be 25.0. We need to give different output for different input. So we have to write (bill*20/100) Instead of 125. if the input is 125, it will calculate like (125*20/100) and output will be 25.0 . if the input is 268, it will calculate like (268*20/100) and output will be 53.6 .
26th Sep 2021, 4:40 PM
Myo Thuzar
Myo Thuzar - avatar
+ 2
May be something went wrong that you didn't realize at that time.Whatever, keep going, keep coding, fighting 💪
26th Sep 2021, 5:10 PM
Myo Thuzar
Myo Thuzar - avatar
+ 1
bill = int(input()) #your code goes here Mancia = (125 * 20) / 100 print (Mancia) Whit this code it will give me a green check with first test cases. bill = int(input()) #your code goes here Mancia = (125 * 20) / 100 Mancia2 = (268 * 20) / 100 print (Mancia) print (Mancia2) With this code,i've both the result (25.0 and 53.6) but the system give me the double red cross,in both of the cases the third test cases is locked and obscured N.D I'm italian, Mancia equival to Tip
26th Sep 2021, 4:29 PM
Luigi Pietragalla
Luigi Pietragalla - avatar
+ 1
Dude this is brutal :D I'm sure i've tried in the past to insert bill because it's a variable but it won't work but this time yes, for sure your code is correct (tried and worked) but i'm starting to think i'm a donkey. Thank you for help, explanation and support!
26th Sep 2021, 5:05 PM
Luigi Pietragalla
Luigi Pietragalla - avatar