两道Python的题 关于类的 2 定义类Circle,要求具有以下方法,编写测试程序进行功能演示(文本方式即可)
Circle(point,r):根据给定的圆心和半径生成一个圆,圆心的实现也请定义一个类
moveto(point):将圆心移到新的位置
change_r(x):将半径重新设置为x
get_area():获取面积
3 Create and test a Set class torepresent a classical set. Your sets should support the following methods:
Set(elements)Create a set (elements is the initial list of items in the set).
addElement(x)Adds x to the set.
deleteElement(x)Removes x from the set.
member(x) Returns trueif x is in the set.
intersection(set2)Returns a new set containing just those elements that are common to thisset and set2.
union(set2) Returns a newset containing all of elements that are in this set, set2, or both.
subtract(set2)Returns a new set containing all the elements of this set that are not inset2.
注意:有些方法有返回值,有些没有
表示看不懂……不会写
英语作业帮用户2017-11-03举报