+ 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") ====================

30th Mar 2021, 6:47 AM
Kathiravan P
8 Antworten
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.
30th Mar 2021, 7:13 AM
Slick
+ 2
Try this ! It's working . purity = float(input()) if purity >= 91.7 and purity <=100: print ("Accepted")
26th Aug 2021, 3:58 PM
Harpreet kaur
0
gold that is 99.99999% gold will be rejected by your code. I'd just leave the first condition and it should work.
30th Mar 2021, 6:56 AM
Slick
0
Can you please tell me the code.
30th Mar 2021, 7:04 AM
Kathiravan P
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") ----------------------------------------
16th Aug 2021, 12:32 AM
Ahmed Ayman Soliman
0
purity = float(input()) if purity >= 91.7: print ("Accepted") it works for all test case
19th Oct 2021, 6:11 PM