+ 6
#...._._...._<........>
i am quite sure that the issue is with the sequence of the operators and the values. in ideal case there is no issue, but since we are using float numbers there is a difference. this is not incorrect what you have done, and it is also no bug, it is just as it is.
using these values:
=> price: 7
=> percent: 10
the result is different depending like mentioned abouve:
your lambda: (lambda x, y: x / 100 * y) :
7
10
result: 0.7000000000000001
modified lambda: (lambda x,y:x*y/100) :
7
10
result: 0.7
+ 4
#...._._...._<........>
I ran your code and it seems fine, so I would suggest to look at rounding to 2 places.
For example 10 with a 30 discount will produce 3.333333333
But, when talking money, 2 decimal places are expected -> 3.33
I don't know if this will resolve the problem, but without access to your challenge details, I can only surmise
+ 4
Rik Wittkopp ,
you are right, rounding with round(..., 2) will pass the test cases also
+ 3
Lothar ,
yeah!
you are right.
your modified lambda is right; with that modification i successfully passed all the test cases.🤩😄
+ 3
Lothar
&
Rik Wittkopp ,
😃🙏Thank you so much both of you..🎊👏🙌