[Solved] Ballpark order. Swift | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[Solved] Ballpark order. Swift

What is wrong with my code? It solved both open tests, but no one of hidden... Edit: Uldfang as the pro code coaches need to be set private so no-one can copy those so I've maded it private and removed the link.

10th Oct 2020, 6:33 PM
Uldfang
 Uldfang - avatar
5 Answers
+ 9
Uldfang For total cost of food and drink the print statement should be like this in the last time. Rest all the criteria is matching. Might be you missed something in question statement so just try with this I hope it will solve your query. print(price+(price * 0.07))
10th Oct 2020, 6:43 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 8
Uldfang It's basically not difference but that test cases are failing because of rounding values if you need to use (price*1.07) just round the result of price till 2 decimal places. After that code will be run fine.. When I've tried that problem months ago some issue with rounding comes up so doing like more opened way it solved else you can add an rounding method till 2 places after decimal that will too work to solve the problem..
10th Oct 2020, 7:25 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
okay, will try to chage post)
10th Oct 2020, 6:39 PM
Uldfang
 Uldfang - avatar
0
TY, it solved a problem, but whats the difference between (price * 1.07) and (price + (price * 0.07)
10th Oct 2020, 6:52 PM
Uldfang
 Uldfang - avatar
0
TY a lot
10th Oct 2020, 7:30 PM
Uldfang
 Uldfang - avatar