


PREDICT · READ BEFORE YOU WRITE
What does this program print?
Read the program like the computer would, then call the output before you run anything.
class StarMeta(type):
def __new__(cls, name, bases, attrs):
new_attrs = {}
for key, val in attrs.items():
if not key.startswith("__"):
new_attrs[key.upper()] = val
else:
new_attrs[key] = val
return super().__new__(cls, name, bases, new_attrs)
class Nebula(metaclass=StarMeta):
star_name = "Orion"
n = Nebula()
print(hasattr(n, "star_name"), hasattr(n, "STAR_NAME"))