+ 1
If statement
You’re making a gold purity checker, that should accept only 22K or 24K gold. Only the good stuff! 22K gold has 91.7% or more gold in it, while 24K corresponds to 99.9% and above purity. Given the % of gold purity as input, you should output "Accepted" only if it corresponds to 22 or 24K. Sample Input: 93.4 Sample Output: Accepted And my code is... ==================== purity=float(input()) if 91.7<=purity and 99.9>=purity: print ("Accepted") ====================
8 Respostas
0
No keep trying.
One more hint, it says 24k gold corresponds to 99.9% and above. Your code STOPS at 99.9% meaning if the purity is 99.99% it will not be accepted by your code. Change it so it accepts anything above 99.9% or just lose that bit of code alltogether.
+ 2
Try this ! It's working .
purity = float(input())
if purity >= 91.7 and purity <=100:
print ("Accepted")
0
gold that is 99.99999% gold will be rejected by your code.
I'd just leave the first condition and it should work.
0
Can you please tell me the code.
0
This is my code. But its not working on test case 5
-------------------------------------
purity = float(input())
if purity >= 91.7:
print ("Accepted")
if purity >= 99.9:
print ("Accepted")
if purity >= 99.99999:
print ("Not Accepted")
----------------------------------------
0
purity = float(input())
if purity >= 91.7:
print ("Accepted")
it works for all test case
0
purity = float(input())
#your code goes here
if purity >= 91.7:
print ("Accepted")
elif purity >= 99.9:
print ("Accepted")
- 1
The first 4 test cases are passed but the lastone 5th hidden testcase was failed. I can't identify what is the bug in the code any one please help me to move on next step.