+ 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
7 Answers
+ 1
you are breaking if something is less than 20 so your loop isnât going trough all your items.
+ 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
+ 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')
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?
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
0
You are right! How embarrasingđ
Thank you!đ
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")