正在加载图片...
member (x)Returns true if x is in the set and false otherwise. intersection(set2)Returns a new set containing just those elements that are common to this set and set2. union(set2)Returns a new set containing all of elements that are in this set,set2,or both display()Show all the elements in the set Use the following program to test your new class. def main(): 1st1=[1,2,3,4,5,6] 1st2=[5,6,7,8,9] s1=Set(Ist1) s2=Set(Ist2) s1.addElement(8) s2.deleteElement(10) s3=s1.intersection(s2) s4=s1.union(s2) s3.display() s4.display() 程序文件命名:3pymember (x) Returns true if x is in the set and false otherwise. intersection(set2) Returns a new set containing just those elements that are common to this set and set2. union (set2) Returns a new set containing all of elements that are in this set, set2, or both. display() Show all the elements in the set Use the following program to test your new class. def main(): lst1=[1,2,3,4,5,6] lst2=[5,6,7,8,9] s1=Set(lst1) s2=Set(lst2) s1.addElement(8) s2. deleteElement(10) s3=s1. intersection(s2) s4=s1.union(s2) s3.display() s4.display() 程序文件命名:3.py
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有