Hotel Prices problem does not resolve | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hotel Prices problem does not resolve

https://code.sololearn.com/cnBd3MgpHAMj/?ref=app The sample solution as visualized by me does not indicate solved status. Could someone point out why ?

1st Oct 2022, 6:59 AM
Sanjay Kamath
Sanjay Kamath - avatar
8 Answers
+ 6
Sanjay Kamath , the code is not complete. > this is the task description: You are given an array that represents house prices. Calculate and output the percentage of houses that are within one standard deviation from the mean. To calculate the percentage, divide the number of houses that satisfy the condition by the total number of houses, and multiply the result by 100. > the current code just calculates and uses the mean, but not the standard deviation for getting the final result. read the task description carefully.
1st Oct 2022, 11:02 AM
Lothar
Lothar - avatar
+ 5
Sanjay Kamath , no - i can not give you the solition, since i am sure you can do it by yourself. read my comments in the attached file: https://code.sololearn.com/c9bZ6GwcX49G/?ref=app
4th Oct 2022, 4:48 PM
Lothar
Lothar - avatar
+ 4
Sanjay Kamath , the calculated values for *mean* and *standard deviation* are ok. but the rest of the code is not doing the required steps to get the final result. *AND* - the formatting of the code and the variable names are slightly horrable. we should use meaningful variable names. let me try to describe the steps we need to do for solving the task. (1) we need to calculate the mean that is required in a later step [done] (2) we need to calclate the standard deviation [done] (3) now we have to get 2 values that are a *kind of span* starting from the mean value. lower bound use: mean - standard deviation. upper bound use: mean + standard deviation. (4) now we have to find the number of all house prices that are inside the *span* defined in (3) (5) finally we have to calculate the percentage of these houses from step (4) compared to the total numer of houses.
1st Oct 2022, 6:02 PM
Lothar
Lothar - avatar
+ 1
What's the task? Can you add it?
1st Oct 2022, 8:44 AM
Ausgrindtube
Ausgrindtube - avatar
1st Oct 2022, 12:47 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
Lothar https://code.sololearn.com/cQ24Otzouppb/?ref=app Format is OK but answer is not correct..... Any guesses?
3rd Oct 2022, 1:24 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
Sanjay Kamath you have an array "li" but for what?
3rd Oct 2022, 2:59 PM
Ausgrindtube
Ausgrindtube - avatar
0
Can you please give me the solution? Viz answer for reverse engineering
4th Oct 2022, 5:21 AM
Sanjay Kamath
Sanjay Kamath - avatar