+ 1

Tip Calculator: Test Case 3

Hey all, I cannot figure out the third test case for the Python for Beginners lesson 20 a.k.a. The tip calculator. My code: bill = int(input()) print(float(bill*0.2)) This☝🏼unlocked the Test Cases 1 & 2. I looked up and tried other code for this challenge but they still don’t solve for 3.

28th Jul 2021, 4:00 AM
James Shin
15 Antworten
+ 2
Yeah, maybe a bug. Somehow, try again later even if this is not working print(int(input())*0.2)
28th Jul 2021, 4:18 AM
Simba
Simba - avatar
+ 2
Yes it's the brain stormer which makes us go crazy like why the heck I can't see my own project's answers
30th Jul 2021, 6:54 PM
Aashay
+ 1
James Shin No need to convert in float because 0.2 will automatically convert. So just do this: print(bill * 0.2)
28th Jul 2021, 5:23 AM
A͢J
A͢J - avatar
+ 1
bill = int(input()) print(float(bill*20/100)) use this it works (for me though) and upvote if you get the correct in TC3.
30th Jul 2021, 6:45 PM
Aashay
+ 1
Aashay Simba ive discovered the problem, and it’s really stupid. All the code above works and passes all three test cases, but because im a trial pro user (maybe) they aren’t unlocked for me to view..
30th Jul 2021, 6:48 PM
James Shin
+ 1
so you mean you've already passed but you didn't knew about it though
30th Jul 2021, 6:49 PM
Aashay
+ 1
both are same
30th Jul 2021, 6:52 PM
Aashay
+ 1
Aashay yes. The UI shows a check mark, but it is “locked” so I cannot see the input or output for that third test case
30th Jul 2021, 6:52 PM
James Shin
+ 1
Aashay If you can see all test cases then you can write Hard Code logic which may not be right because you may solve few test cases but if we try to put another test case so there maybe less chance to have a correct logic. That's why test cases are hidden so you can write correct logic which may satisfy condition for 1000 test cases.
30th Jul 2021, 6:58 PM
A͢J
A͢J - avatar
+ 1
I think the third case is literally a check of how you've written it and not any integer values so that they don't show it.
30th Jul 2021, 7:01 PM
Aashay
0
Simba Nice catch! I actually did make sure to have that last parentheses in my original code. I just forget here I guess 😂 Edited with the correction, but TC3 remains locked 🤔
28th Jul 2021, 4:07 AM
James Shin
0
Simba I did! I literally copied and pasted your reply and it didnt work for TC3 maybe my app is just glitchy..
28th Jul 2021, 4:13 AM
James Shin
0
A͢J oh yeah, you’re right! I totally forgot that if int*float, output = float. Did I paraphrase that correctly? Also, I still can’t get TC3 with anything proposed above. Problem remains unsolved. Maybe if someone provided the input for that..
29th Jul 2021, 5:58 AM
James Shin
0
James Shin I this you are doing some mistake. This code is working for me. bill = int(input()) #your code goes here print (bill * 0.20)
30th Jul 2021, 6:51 PM
A͢J
A͢J - avatar
0
James Shin No-one can see hidden test cases.
30th Jul 2021, 6:51 PM
A͢J
A͢J - avatar