0
Listing Functions
Hello guys Kindly help You are analyzing house prices. The given code declares a list with house prices in the neighborhood. You need to calculate and output the number of houses that have a price that is above the average. To calculate the average price of the houses, you need to divide the sum of all prices by the number of houses.
2 Antworten
+ 1
Joshua chola
Before asking solution show your attempts.
0
import numpy as np
data = np.array([150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, 290000, 300000, 500000, 420000, 100000, 150000, 280000])
#your code goes here
mean = np.mean(data)
std = np.std(data)
low = mean-std
high = mean+std
count = 0
for i in data:
if low < i < high:
count += 1
result = (count / len(data))
print(100*count/data.size