+ 4

Need some help with Boolean Logic 2

Hello! Could someone tell me what's wrong with this code exactly? purity = float(input()) #your code goes here if purity >= 75.0 and purity < 83.3: print ("18K") if purity >= 83.3 and purity < 91.7: print ("20K") if purity >= 91.7 and purity < 99.9: print ("21K") if purity > 99.9: print ("24K") It works for the first 3 cases, also for the cases 4 and 7 from the hidden ones, but it marks as invalid for the cases 5 and 6, and i can't notice why since they're locked

24th Apr 2021, 6:48 AM
RogerRM
RogerRM - avatar
2 Antworten
+ 12
purity = float(input()) if 75.0 <= purity < 83.3: print ('18K') elif 83.3 <= purity < 91.7: print ('20K') elif 91.7 <= purity < 99.9: print ('22K') else: print ('24K') Check this one now. This works.
24th Apr 2021, 7:06 AM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
0
Can you post your question? RogerRM
24th Apr 2021, 7:02 AM
Atul [Inactive]