Can someone please explain to me why my code isn’t putting the output i want?

so this code is suppose to output all the data that goes with each town name, but its not outputting anything and im a little lost.

This is what i have:

def calculate_average_height(height_data):
    total_height = sum(height_data)
    average_height = total_height / len(height_data)
    return average_height


def find_closest_height(height_data, average_height):
    closest_height = min(height_data, key=lambda h: abs(h - average_height))
    return closest_height


def find_second_closest_height(height_data, closest_height):
    second_closest_height = min([h for h in height_data if h != closest_height], key=lambda h: abs(h - average_height))
    return second_closest_height


def main()
    city_data = [
        {"city": 'Ely', 'Population”': 10, 'Height': [67, 66, 68, 62, 65, 64, 84, 71, 62, 81], "names": ['Mariam Cox', 'Mikayla Bonner', 'Jaquelyn Bowman', 'Henry Dickson', 'Daniel Ashley', 'Michelle Wilkerson', 'Shannon Hogan', 'Justine Carrillo', 'Dustin Lara', 'Gabriel Graham']},
        {"city": 'Grand Marais', 'Population': 11, 'Height': [75, 81, 62, 67, 83, 63, 76, 65, 68, 69, 65],'names': ['Oliver Clay', 'Rae Finley', 'John Fuentes', 'Macy Baxter', 'Quentin Campbell', 'Kareem Cummings','Keane Mckenzie', 'Marah Kelley', 'Scott Chambers', 'Oren Gilmore', 'Colton Osborn']},
        {"city": 'Finland', 'Population': 15, 'Height': [68, 80, 64, 81, 81, 83, 62, 72, 68, 62, 72, 66, 69, 71, 63],'names': ['Brady Joyce', 'Harding Jones', 'Zeph Dorsey', 'Phelan Good', 'Kai Mcfarland', 'Giacomo Goodman','Nigel Pena', 'Basil Lawrence', 'Julian Reynolds', 'Alexis Compton', 'Paki Franklin','Clio Valencia','Simon Holt', 'Griffith Watson', 'Maxine Graves']},
        {"city": 'Knife River', 'Population': 11, 'Height': [64, 81, 68, 65, 74, 73, 82, 77, 79, 76, 76],'names': ['Marvin Powell', 'Clio Henry', 'Hall Mason', 'Genevieve Gardner', 'Audra Watkins', 'Eagan Garza','Brock Bolton', 'Mufutau Harrington', 'Gannon Shaw', 'Amery Orr', 'Lane Diaz']},
        {"city": 'Lutsen', 'Population': 14, 'Height': [70, 79, 75, 67, 66, 65, 69, 78, 76, 61, 67, 79, 67, 77], 'names': ['Kelly Washington', 'Charity Moran', 'Dustin Wall', 'September Mcgowan', 'Deirdre Weaver', 'Audra Hopkins', 'Roanna Tyson', 'Winter Herrera', 'Desiree Ramsey', 'Maryam West', 'Xena Hewitt', 'Lester Tanner', 'Lesley Contreras', 'Rashad Hartman']},
        {"city": 'Grand Portage', 'Population': 11, 'Height': [70, 73, 71, 84, 66, 82, 79, 60, 64, 77, 78], 'names': ['Hanna Carr', 'Vivien Alexander', 'Lareina Sims', 'Shelley Compton', 'Alec Pratt', 'Kirestin Torres','Isaiah Brewer', 'Buffy Hewitt', 'Ryder Bean', 'Cherokee Freeman', 'Victoria Watkins']},
        {"city": 'Two Harbors', 'Population': 6, 'Height': [66, 77, 82, 63, 84, 75], 'names': ['Blake Clayton', 'Rinah Durham', 'Chiquita King', 'Cathleen Beard', 'Camilla Preston','Gloria Waller']},
        {'city': 'Silver Bay', 'Population': 8, 'Height': [83, 68, 82, 71, 76, 78, 78, 66],
         'names': ['Lucius Henson', 'Madeline Baird', 'Amos Chang', 'Avye Chandler', 'Sarah Chang', 'Marah Mclean','Brady Houston', 'Britanney Sandoval']},
        {"city": 'Hovland', 'Population': 4, 'Height': [76, 83, 66, 74], 'names': ['Jack Guntrie', 'Burke Whitney', 'Molly Mclaughlin', 'Joel George']},
        {"city": 'Beaver Bay', 'Population': 10, 'Height': [69, 69, 68, 68, 69, 70, 78, 74, 80, 75], 'names': ['Igor Moore', 'Caldwell Bullock', 'Ralph Sanchez', 'Abraham Aquirre', 'Odysseus Alston', 'Aphrodite Mays', 'Raymond Clark', 'Ivor Melton', 'Lareina Hickman', 'Mackensie Burch']}]

    for city in city_data:
        average_height = calculate_average_height(city["Height"])
        closest_height = find_closest_height(city["Height"], average_height)
        second_closest_height = find_second_closest_height(city["Height"], closest_height)

        # Find corresponding person names (similar to the original code)

        print(f"{city['city']} ({city['Population']} people):")
        print(f"Average height: {average_height:.2f} cm")
        print(f"Closest height to average: {closest_height} cm (Person: {closest_person_name})")
        print(f"Second closest height to average: {second_closest_height} cm (Person: {second_closest_person_name})")
        print()  # Add a newline for readability


if __name__ == "__main__":
    main()

I have tweaked it repeatedly but nothing helped and i didnt really know where to go from there. i would like the output to contain all cities along with the other functions i created.

New contributor

ltrow2017 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật