Python Data Structures Fancy Houses Task Question
Hey Guys I have a Problem. I think my code solves the problem, but i can not pass because sololearn shows that my answer is not correct and I can not look what is wrong because the case is closed. Maybe some of you guys could pass the task and find the problem. Task: 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. My solution: prices = [125000, 78000, 110000, 65000, 300000, 250000, 210000, 150000, 165000, 140000, 125000, 85000, 90000, 128000, 230000, 225000, 100000, 300000] #your code goes here average_price = int(sum(prices))/int(len(prices)) # print(int(average_price)) for n in prices: if n < int(average_price): prices.remove(n) print(len(prices)) Average Price: 159777 Output (Number of houses above the average price): 11 Sorry for the long post