0

Stuggling with Super Sale Challenge

I can't seem to get the hidden test #4 to pass. I have tried both int and floor together and separate. Any suggestions would be much appreciated. import math items = (input()).split(",") items.sort() total = 0 for i in items[:-1]: total += int(i) savings = total * .3 * 1.07 print(int(math.floor(savings)))

7th Mar 2020, 3:43 AM
DAYLINER BAND
DAYLINER BAND - avatar
5 Respuestas
+ 2
Try Items=([float(x) for x in input().split(",")])
10th Mar 2020, 7:58 AM
Matthias Matznick
Matthias Matznick - avatar
+ 2
Try converting to float already during input. Solved the problem for me, though I still don't fully understand it. In my solution I convert to float when calling the element from the list, before any mathematical operations are conducted. But hey, I can find peace now 🥴. I'd be thankful for any explanation though. https://code.sololearn.com/cexwZ58s25El/?ref=app
9th Mar 2020, 7:29 PM
Matthias Matznick
Matthias Matznick - avatar
+ 1
I'm stuck with the same problem, I can feel your pain 😁
7th Mar 2020, 1:46 PM
Matthias Matznick
Matthias Matznick - avatar
+ 1
Tried changing the int(i) to a float but no luck with my method. Glad you got it to work for your program. I guess I will have to keep at it.
9th Mar 2020, 9:58 PM
DAYLINER BAND
DAYLINER BAND - avatar
0
Worked Matthias! Thank you so much. I will have to try and firgure out why it working.
11th Mar 2020, 12:50 AM
DAYLINER BAND
DAYLINER BAND - avatar