【两道Python的题关于类的2定义类Circle,要求具有以下方法,编写测试程序进行功能演示(文本方式即可)Circle(point,r):根据给定的圆心和半径生成一个圆,圆心的实现也请定义一个类moveto(point)】
两道Python的题关于类的2定义类Circle,要求具有以下方法,编写测试程序进行功能演示(文本方式即可)
Circle(point,r):根据给定的圆心和半径生成一个圆,圆心的实现也请定义一个类
moveto(point):将圆心移到新的位置
change_r(x):将半径重新设置为x
get_area():获取面积
3CreateandtestaSetclasstorepresentaclassicalset.Yoursetsshouldsupportthefollowingmethods:
Set(elements)Createaset(elementsistheinitiallistofitemsintheset).
addElement(x)Addsxtotheset.
deleteElement(x)Removesxfromtheset.
member(x)Returnstrueifxisintheset.
intersection(set2)Returnsanewsetcontainingjustthoseelementsthatarecommontothissetandset2.
union(set2)Returnsanewsetcontainingallofelementsthatareinthisset,set2,orboth.
subtract(set2)Returnsanewsetcontainingalltheelementsofthissetthatarenotinset2.
注意:有些方法有返回值,有些没有
表示看不懂……不会写