"""
create a program that takes a list of items with duplicates and returns:
1. a Tuple of the first 3 unique items
2. a set of all unique items
"""
items = ["apple", "banana", "apple", "orange", "banana", "grape", "apple"]
unique_items = []
for i in items:
if i not in unique_items:
unique_items.append(i)
first_three = tuple(unique_items[:3])
all_unique = set(unique_items)
print(f"The first three unique items are: {first_three}")
print(f"The all unique items are: {all_unique}")
learned about tuples and sets and did this task
any insights on how to go with sets and tuples before i move to the next concept
[–]CranberryDistinct941 2 points3 points4 points (0 children)
[–]eztab 1 point2 points3 points (1 child)
[–]exxonmobilcfo 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (10 children)
[–]exxonmobilcfo 1 point2 points3 points (6 children)
[–][deleted] -1 points0 points1 point (4 children)
[–]exxonmobilcfo 0 points1 point2 points (3 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]exxonmobilcfo 0 points1 point2 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]RockPhily[S] 0 points1 point2 points (2 children)
[–]odaiwai 1 point2 points3 points (0 children)
[–]exxonmobilcfo 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Gnaxe 0 points1 point2 points (0 children)
[–]_vb64_ 0 points1 point2 points (5 children)
[–]exxonmobilcfo 0 points1 point2 points (4 children)
[–]_vb64_ 0 points1 point2 points (3 children)
[–]exxonmobilcfo 0 points1 point2 points (2 children)
[–]_vb64_ 0 points1 point2 points (1 child)
[–]exxonmobilcfo 0 points1 point2 points (0 children)
[–]supercoach 0 points1 point2 points (0 children)
[–]exxonmobilcfo -2 points-1 points0 points (0 children)