Ask coding questions

← Back to all posts
(Sets) Difference_code not working?
nbvolz416 (0)

science_friends= ("nick","cathy")
art_friends= ("nick","mary","jon")
science_friends_not_art= science_friends.difference(art_friends)
art_friends_not_science_friends= art_friends.difference(science_friends)

print(science_friends_not_art)
print(art_friends_not_science_friends)

Comments
hotnewtop
nbvolz416 (0)

File "main.py", line 5, in <module>
science_friends_not_art= science_friends.difference(art_friends)
AttributeError: 'tuple' object has no attribute 'difference'