0

I need help with the super sale code coach challenge. My code is accepted for 6 out of 7 test cases

I’m trying to do the super sale code challenge. My code is failing “Test case 4” but passes the other 6 Test cases. Not sure what I’m missing. I’ve spent all day making tweaks and I can’t figure it out. It doesn’t help that the Test case is locked so I can’t see what’s being inputted. Here’s my code: https://code.sololearn.com/cP8Ogq45h22n/?ref=app

17th Oct 2023, 2:21 AM
Josh Rhodes
4 ответов
0
This is the challenge: Your favorite store is having a sale! You pay full price for the most expensive item that you get, but then you get 30% off of everything else in your purchase! How much are you going to save? Sales tax is 7%. Also, you leave anything below a dollar in your saving as a tip to the seller. If your saving is a round amount, you don't leave any tips. Task: Given the prices of items you want to purchase, determine how much you will save during your shopping! Input Format: A string of numbers separated by commas that represents the prices for all of the items that you want to purchase (without tax). Output Format: An integer number that represents the total savings that you got for shopping during the sale.
17th Oct 2023, 2:22 AM
Josh Rhodes
0
Hello Josh Rhodes, I think you are little rushed again. Take a closer look on the sample input: Sample Input: 100.25, 80.99, 40.00 Compare to your code, is there something off?
17th Oct 2023, 2:38 AM
Wong Hei Ming
Wong Hei Ming - avatar
0
Wong Hei Ming I changed “int” to “float” in the first for loop and that did the trick!
17th Oct 2023, 3:02 AM
Josh Rhodes
0
Josh Rhodes, I think it is best to leave the code as it was so others can understand what is the problem in the future.
17th Oct 2023, 3:30 AM
Wong Hei Ming
Wong Hei Ming - avatar