# Cats with hats
theCats = {}
loops = 0

#create 100 hatless cats in theCats dictionary
for i in range(1, 1001):
    theCats["Cat " + str(i)] = False

for i in range(1, 1001):
    loops += 1
    count = 0
    for cat, hats in theCats.items():
        count += 1
        if count % loops == 0:
            if theCats[cat]:
                theCats[cat] = False
            else:
                theCats[cat] = True

# print results
for cat, hats in theCats.items():
    if theCats[cat]:
        print(f"{cat} has a hat!")
    else:
        print(f"{cat} is hatless!")

a1b37349c0daa801a705e632a97e5fb1f12dce4e
<mask token>

<mask token>
for i in range(1, 1001):
    theCats['Cat ' + str(i)] = False
for i in range(1, 1001):
    loops += 1
    count = 0
    for cat, hats in theCats.items():
        count += 1
        if count % loops == 0:
            if theCats[cat]:
                theCats[cat] = False
            else:
                theCats[cat] = True
for cat, hats in theCats.items():
    if theCats[cat]:
        print(f'{cat} has a hat!')
    else:
        print(f'{cat} is hatless!')

theCats = {}
loops = 0
for i in range(1, 1001):
    theCats['Cat ' + str(i)] = False
for i in range(1, 1001):
    loops += 1
    count = 0
    for cat, hats in theCats.items():
        count += 1
        if count % loops == 0:
            if theCats[cat]:
                theCats[cat] = False
            else:
                theCats[cat] = True
for cat, hats in theCats.items():
    if theCats[cat]:
        print(f'{cat} has a hat!')
    else:
        print(f'{cat} is hatless!')

# Cats with hats
theCats = {}
loops = 0

#create 100 hatless cats in theCats dictionary
for i in range(1, 1001):
    theCats["Cat " + str(i)] = False

for i in range(1, 1001):
    loops += 1
    count = 0
    for cat, hats in theCats.items():
        count += 1
        if count % loops == 0:
            if theCats[cat]:
                theCats[cat] = False
            else:
                theCats[cat] = True

# print results
for cat, hats in theCats.items():
    if theCats[cat]:
        print(f"{cat} has a hat!")
    else:
        print(f"{cat} is hatless!")
