import uuid
# A GUID (Globally Unique Identifier) and a UUID (Universally Unique Identifier)
# are essentially the same, both being 128-bit values used to uniquely identify
# information in computer systems.
def main():
# Create a set containing three randomly generated UUIDs.
# uuid.uuid4() produces a type‑4 GUID.
guids = {
uuid.uuid4(),
uuid.uuid4(),
uuid.uuid4()
}
# Compute a hash value for the entire set.
# hash(...) is idiomatic Python for combining values into a single hash.
hash_value = hash(frozenset(guids)) # sets must be frozen to be hashable
# Print the GUIDs so we can see what was hashed.
print("GUIDs in the set:")
for g in guids:
print(g)
# Print the resulting hash value.
print("\nHash of the GUID set:", hash_value)
if __name__ == "__main__":
main()
"""
run:
GUIDs in the set:
381664de-edeb-45fa-bf66-6794dc2f00a7
fa895f77-1bc6-42ad-993a-9502feaf5109
ce55b239-95cb-480f-8f1b-f94879f80625
Hash of the GUID set: 5406426919634175225
"""