无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

加拿大瑞爾森大學(xué) Python習(xí)題 Lab 8

2023-08-24 15:59 作者:逃跑的叮當(dāng)貓  | 我要投稿

s?again.

?

3. ??Write ?a ?class?called?Circle.?The?Circle?class?has?an?instance?variable?called?radius,?and?it?should be initialized with an input?radius, i.e.,?the?method?__init__?accepts?a?number?called?radius. Circle should also?have a method that computes the?circumference.

4. ??Build?a list?of length?1000,?called?circles,?that?contains?circle?objects?of random?radii using?the ?random module.?Write?a?function?called ?circle_cmp that?compares?two?input?circles?based?on?their?circumference. Write?a?new bubble?sort?algorithm?that?accepts?an?extra?input?that?is?a function. The new bubble?sort?algorithm?uses?the?input?function?to?compare?circles.?Use this new version of?the bubble sort to sort circles?using the circle_cmp?function.

5. ??Implement the __lt__?function for the Circle?class?to?accomplish?circle?comparison?based?on?circumference.

6. ??Build?a new list?of circles, like?in?Question?4, but?now?the?circles?in?the?list?have?the?__lt__ function. Use the original bubble?sort algorithm?to?sort this?new?list.?The?original?bubble?sort?algorithm should work for this?list of?circles without any change.


代碼

8-1 Bubble Sort


加拿大瑞爾森大學(xué) Python習(xí)題 Lab 8的評論 (共 條)

分享到微博請遵守國家法律
茂名市| 中江县| 祁东县| 汤原县| 娱乐| 会昌县| 扎赉特旗| 泾阳县| 蒙城县| 宁海县| 靖安县| 松江区| 突泉县| 体育| 灵璧县| 昌图县| 迁安市| 东乡族自治县| 梅州市| 淮北市| 三河市| 巴青县| 微山县| 交口县| 元谋县| 高唐县| 花莲市| 即墨市| 资兴市| 阳泉市| 惠东县| 江油市| 庆安县| 丽江市| 阿巴嘎旗| 沙洋县| 克拉玛依市| 海阳市| 星子县| 营山县| 汉沽区|