From c3f85f78d2dad8c7218d581e495f7b72b0cebe43 Mon Sep 17 00:00:00 2001 From: Noah Sheppard <158862741+NoahSheppard@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:24:52 +1100 Subject: [PATCH] Update 04_fruit_cart.py to fix the extra commented check The file would attempt to pull the "fruits" variable, which is meant to be both fruits. The code fixes this by pushing the code forward, and using the union_fruits variable to follow the comments instruction. If this was intentionally broken to extend the student, please ignore this PR. --- 1-data-structures/04_fruit_cart.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/1-data-structures/04_fruit_cart.py b/1-data-structures/04_fruit_cart.py index d5655e4..5c15ea5 100644 --- a/1-data-structures/04_fruit_cart.py +++ b/1-data-structures/04_fruit_cart.py @@ -4,15 +4,15 @@ my_fruits = {'apple', 'banana', 'kiwi'} friend_fruits = {'banana', 'orange', 'grape'} -# Uncomment to check if a fruit is both list -# print('apple' in fruits) # Output: True -# set3 = {'apple', 'orange'} -# print(set3.issubset(fruits)) # Output: True - union_result = my_fruits | friend_fruits intersection_result = my_fruits & friend_fruits difference_result = my_fruits - friend_fruits +# Uncomment to check if a fruit is both list +# print('apple' in union_result) # Output: True +# set3 = {'apple', 'orange'} +# print(set3.issubset(union_result)) # Output: True + print('Union:', union_result) print('Intersection:', intersection_result) print("My Fruits - Friend's Fruits:", difference_result)