QUESTION IMAGE
Question
challenge activity 3.4.1: set basics. 696502.5708494.qx2mvl jump to level 1 set my_favorites contains \bear\, \horse\, and \urchin\. set your_favorites contains three strings read from input. assign animals_not_shared with the set containing only elements that appear in exactly one of my_favorites and your_favorites. click here for example note: because sets are unordered, the sets are printed using the sorted() function here for comparison. 1 my_favorites = {\bear\, \horse\, \urchin\} 2 your_favorites = {input(), input(), input()} 3 4 \\\ your code goes here \\\ 5 6 print(f\my favorite animals: {sorted(my_favorites)}\) 7 print(f\your favorite animals: {sorted(your_favorites)}\) 8 print(f\animals not shared: {sorted(animals_not_shared)}\)
Step1: Define target set
my_favorites = {"bear", "horse", "urchin"}
Step2: Define input set
your_favorites = {input(), input(), input()}
Step3: Calculate symmetric difference
animals_not_shared = my_favorites ^ your_favoritesSnap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
my_favorites = {"bear", "horse", "urchin"}
your_favorites = {input(), input(), input()}
animals_not_shared = my_favorites ^ your_favorites
print(f"My favorite animals: {sorted(my_favorites)}")
print(f"Your favorite animals: {sorted(your_favorites)}")
print(f"Animals not shared: {sorted(animals_not_shared)}")