Super sale, code doesn't work for one test. Help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Super sale, code doesn't work for one test. Help!

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: An string of numbers separated by commas that. represent 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. Sample Input: 100.25,80.99,40.00 Sample Output: 38 https://code.sololearn.com/c4MR611ustjo/?ref=app

5th Jan 2021, 1:27 PM
Ela O
Ela O - avatar
3 Answers
+ 2
Not quite sure what the problem is, but I noticed 2 thing: 1) Why parse input to int? Shouldn't it be float or double? Because a price can be 123.45... 2) What happens if there are 2 prices of the same value? Like 10.00,10.00? Hope it helps... 😊
5th Jan 2021, 4:30 PM
Lisa
Lisa - avatar
+ 2
It helped me too considering I had this same exact problem. Thanks Lisa!
11th Jan 2021, 11:40 AM
Angelica
Angelica - avatar
+ 1
Yes, it helped! Especially your first point. Thanks a lot! 😃
5th Jan 2021, 6:06 PM
Ela O
Ela O - avatar