0

Problem on the Python course

There is a practice for lambda functions, where i need to write a code that counts a percentage of a number. But, even though i wrote the function right and AI says so, there is a 1 hidden task that is not passed. I don't know if it's a sololearn error or me who's inattentive. (lambda x,y:(x/100)*y)(price, perc)

30th Oct 2023, 3:19 PM
Аdilet Isakov
Аdilet Isakov - avatar
5 Answers
+ 8
Аdilet Isakov , Rearrange the calculation to help avoid tiny floating-point rounding errors. Divide last. (lambda x, y: x*y/100)(price, percentage)
30th Oct 2023, 6:13 PM
Rain
Rain - avatar
+ 3
Hi! Exact were have you found this task? Is the code above all code to solve the problem, or is it just a bit of it? You need two inputs, and convert the inputs to integers. You also have to print your result (your code line above).
30th Oct 2023, 3:59 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Rain thank you, it worked!
30th Oct 2023, 6:16 PM
Аdilet Isakov
Аdilet Isakov - avatar
+ 1
Per Bratthammar thank you too!
30th Oct 2023, 6:16 PM
Аdilet Isakov
Аdilet Isakov - avatar
1st Nov 2023, 5:46 AM
Bob_Li
Bob_Li - avatar