Module 3In-ClassWork (10 pts) 1.Write a Python programto create a set. Create an empty set x and a none empty set n ={ 0, 1, 2, 3, 4}.(1pt) 2.Write a Python program toadd members to a set. Start off...


Module 3In-ClassWork (10 pts)



1.Write a Python programto create a set.



Create an empty set x and a none empty set n ={ 0, 1, 2, 3, 4}.(1pt)




2.Write a Python program toadd members to a set.



Start off with an empty set. Add “Red” to the set.



Update the setwith “Blue” and “Green”.(1pt)




3.Write a Python programto create an intersection of sets.


Use sets x = {green, blue} and y = {blue, yellow}.(1pt)




4.Write a Python programto create a union of sets.(1pt)


Use sets x = {green, blue} and y = {blue, yellow}.




5.Write a Python programto create set difference.(1 pt)


Use sets x = {apple, mango} and y = {mango, orange}.




6.Write a Python programto check if a set is a subset of another set.(2.5 pts)


Use sets x = {apple, mango}, y = {mango, orange}, and z = {mango}. This program should use theissubset()method.




7.Write a Python programto check if two given sets have no elements in common.


Use sets x = {1, 2, 3, 4}, y = {4, 5, 6, 7}, and z = {8}. This program should use theisdisjoint()method.(2.5 pts)


May 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here