+ 1

Code Coach : Duty Free

I cannot for the life of me figure out why only the third case doesn’t solve. My best guess is a rounding error. Please help. https://code.sololearn.com/cTHpSf782iNE/?ref=app

9th Jan 2020, 3:17 AM
Nate Toon
Nate Toon - avatar
7 Answers
+ 1
you are breaking if something is less than 20 so your loop isn’t going trough all your items.
13th Feb 2020, 7:03 AM
Nate Toon
Nate Toon - avatar
+ 1
the #3 does'not solve anymore.I try it with my code and after i copy your code,but it does'not work,please help me
25th Apr 2020, 9:44 AM
Xachatur Xachatryan🇦🇲
Xachatur Xachatryan🇦🇲 - avatar
+ 1
Check out this code :) items = input().split(" ") num = max([eval(i) for i in items]) if num * 1.1 > 20: print('Back to the store') else: print('On to the terminal')
7th Jul 2023, 3:17 PM
BrightJ
BrightJ - avatar
0
I see, thought by making “check” greater than my while loop stipulation would cause a break there. I’m guessing it does’t check the value of “check” again until it’s done with the for loop?
9th Jan 2020, 5:53 AM
Nate Toon
Nate Toon - avatar
0
Hi! Sorry for hijacking your thread, but i have the same problem as you, (#3 doesn't solve), and i am unable to figure out why. I am unfortunately not smart enough to figure out how your tips apply to my code🤔 (I tried 200 200 200 with my code in a python editor, and i got the correct answer, but that was maybe not the point?) Any tips would be much appreciated😀: import math itemsList = [float(s) for s in input().split(" ")] itemsdollar = [float (i *1.1) for i in itemsList ] #print(itemsdollar ) for i in itemsdollar : if i > 20: print("Back to the store") break else: print("On to the terminal") break
10th Feb 2020, 5:25 PM
Elianne Dunthorn Egge
Elianne Dunthorn Egge - avatar
0
You are right! How embarrasing😆 Thank you!😀
13th Feb 2020, 7:35 AM
Elianne Dunthorn Egge
Elianne Dunthorn Egge - avatar
0
Code Coach : Duty Free I tried out this way all the test cases were passing i=[float(s)*1.1 for s in input().split()] f=0 for i in i: if i>20: f=1 break else: f=0 if f==1: print ("Back to the store") else: print ("On to the terminal")
10th Feb 2023, 8:48 AM
TANGI AJITH
TANGI AJITH - avatar