Page 1 of 1

Python: Union of Two or More Sets

Posted: Tue Oct 21, 2025 6:06 pm
by Jason

Code: Select all

first_set_of_Southwest_Virginia_counties = set((Washington, Smyth, Russell, Scott))

second_set_of_Southwest_Virginia_counties = set((Lee, Wise))

print(f "The first set of Southwest Virginia counties is {first_set_of_Southwest_Virginia_counties}. and the second set is {second_set_of_Southwest_Virginia_counties}.")

bigger_set_of_Southwest_Virginia_counties= first_set_of_Southwest_Virginia_counties.union(second_set_of_Southwest_Virginia_counties)

print(f "The first set of counties joined to the second produce {bigger_set_of_Southwest_Virginia_counties}.")