0

House prices question bug

Hi I cant get the certification because of a bug in this question, I answered it in many ways that worked for me on Python in my computer And it doesnt seem to work anyway.

25th Dec 2021, 7:26 PM
Miri Avraham
5 Respuestas
+ 1
My code passed the House Prices task, so it seems unlikely there is a bug in the question/answer. May we see what you tried so we can help?
26th Dec 2021, 4:19 AM
Brian
Brian - avatar
+ 1
Miri Avraham the only issue in the code is that count is not initialized before the loop. Insert count=0 and then the program should pass the test!
26th Dec 2021, 7:32 AM
Brian
Brian - avatar
+ 1
Thank you!
26th Dec 2021, 7:38 AM
Miri Avraham
0
import numpy as np data = np.array([150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, 290000, 300000, 500000, 420000, 100000, 150000, 280000]) avg=np.mean(data) std=np.std(data) sum=np.size(data) for i in data: if i>(avg-std) and i<(avg+std): count+=1 result = (count/sum)*100 print(result)
26th Dec 2021, 6:35 AM
Miri Avraham
0
I wrote my code(up here) Would like your review, Thanks
26th Dec 2021, 6:37 AM
Miri Avraham