+ 1

Stuck on Super Sale Code Coach Python

I fail on test 3, 4, and 7 https://sololearn.com/coach/58/?ref=app import math prices = input().split(",") discount = .3 tax = 1.07 subtotal = [] subtotalWD = [] for price in prices: if price == max(prices): pass else: subtotal.append(int(price)) subtotalWD.append((int(price) - (int(price)) * discount)) print(math.floor(sum(subtotal) - sum(subtotalWD)))

6th Jan 2021, 4:31 AM
Jacob Hargrave
Jacob Hargrave - avatar
9 Respuestas
+ 1
Hope this passes all the tests: https://code.sololearn.com/cEooqVmWKNr3/?ref=app
6th Jan 2021, 4:01 PM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Jacob Hargrave Sent solution in DM.
6th Jan 2021, 4:47 AM
CHANDAN ROY
CHANDAN ROY - avatar
+ 1
Could you please post the question? Might as well be a challenge for users who haven't bought the pro version.
6th Jan 2021, 7:54 AM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Calvin, here's the Q (also, I recommend getting pro subscription. The extra challenges and no ads are worth it) : 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
6th Jan 2021, 2:09 PM
Jacob Hargrave
Jacob Hargrave - avatar
+ 1
I'll try it out. Thanks!
6th Jan 2021, 4:07 PM
Jacob Hargrave
Jacob Hargrave - avatar
+ 1
Jacob Hargrave Did it pass all the tests?
7th Jan 2021, 3:02 AM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Calvin Sheen Thomas yes, it passes all tests! Thanks. Now I just need to try to dissect this and compare the output at each step
7th Jan 2021, 4:48 AM
Jacob Hargrave
Jacob Hargrave - avatar
+ 1
Just wanted to know if there were any errors. You're welcome, Jacob Hargrave.
7th Jan 2021, 4:51 AM
Calvin Thomas
Calvin Thomas - avatar
0
Fine
6th Jan 2021, 4:28 PM
Calvin Thomas
Calvin Thomas - avatar