numberOfZones = int(input("input the number of zones:"))
spacesPerZone= int(input("input the number of spaces per zone:"))
zone_counter=1
max_free_Spaces=-1
space_counter=0
occupied_count=0
totalSpaces=0
zone_with_max_free=0
free_Spaces=0
#this was named "numberofzones" which is not correct.
while zone_counter <= numberOfZones:
    zone_free_spaces = 0
    space_counter = 0
    while space_counter < spacesPerZone:
        #this was originally Spaces_Per_Zone, which is not correct
        print(f"space {space_counter+1} zone {zone_counter}")
        try:
            occupancyStatus = int(input("is this space occupied (1=yes, 0=no):"))
        except:
            print("invalid input, try again")
            continue
        if occupancyStatus == 1:
            print(f"space {space_counter + 1} is occupied")
            occupied_count += 1
        elif occupancyStatus == 0:
            print(f"space {space_counter + 1}  is not occupied")
            zone_free_spaces += 1
        else:
            print("Invalid input, please enter 1 or 0.")
            continue
        space_counter += 1
        print()
    if zone_free_spaces > max_free_Spaces:
        max_free_Spaces = zone_free_spaces
        zone_with_max_free = zone_counter
    zone_counter += 1
print("Summary")
totalSpaces = numberOfZones * spacesPerZone
free_Spaces = totalSpaces - occupied_count
occupancy_percent = (occupied_count / totalSpaces) * 100

print(f"zone {zone_with_max_free} has the most free spaces")
print(f"free spaces = {free_Spaces}")
print(f"total spaces = {totalSpaces}")
print(str(f"{occupied_count} occupied"))
print(str(f"{occupancy_percent:.2f}% space used"))
if occupancy_percent > 80:
    print("warning! high amount of spaces occupied")