Created
March 18, 2019 21:00
-
-
Save yeaske/ef403c004505e0ad6a77056fbbe6363b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(f"Total number of elements in list: {len(object_list)}") | |
# for obj in object_list: | |
# print(obj) | |
# Create a set from the list of objects | |
object_set = set(object_list) | |
# OR | |
object_set = {*object_list} | |
# OR | |
object_set = set() | |
for obj in object_list: | |
object_set.add(obj) | |
print(f"Total number of elements in set: {len(object_set)}") | |
# for obj in object_set: | |
# print(obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment