美文网首页
Python-46~50

Python-46~50

作者: AoEliauk | 来源:发表于2020-10-27 15:38 被阅读0次

---46---

Question:

>Define a class named American and its subclass NewYorker.

Hints:

>Use class Subclass(ParentClass) to define a subclass.

Solution :


---47---

Question:

>Define a class named Circle which can be constructed by a radius. The Circle class has a method which can compute the area.

Hints:

>Use def methodName(self) to define a method.

Solution:


---48---

Question:

>Define a class named Rectangle which can be constructed by a length and width. The Rectangle class has a method which can compute the area.

Hints:

>Use def methodName(self) to define a method.

Solution:


---49---

Question:

>Define a class named Shape and its subclass Square. The Square class has an init function which takes a length as argument. Both classes have a area function which can print the area of the shape where Shape's area is 0 by default.

Hints:

>To override a method in super class, we can define a method with the same name in the super class.

Solution:


---50---

Question:

>Please raise a RuntimeError exception.

相关文章

  • Python-46~50

    ---46--- Question: >Define a class named American and its...

  • 调色

    亮度100,光感-50,对比度50,饱和度50,锐化50,结构50,高光-50,色调50,亮度-50

  • 记一个前端居中的坑

    css使用 top: 50%; left: 50%; transform: translate(-50%, -50...

  • 《50+50》

    文/杨杨杨小米粒 2016年9月20日,我遇到了我的五十分先生。 他是一名军人,而我是一名普通得不能再普通的大学生...

  • 50/50法则

    最近发现自己之前看过的书,学过的东西好像很快就忘了,再看的时候只觉得内容很熟悉,但是要点很模糊,几乎算是白学了。记...

  • 50:50练习

    早上醒来,嘟嘟连续咳嗽了几声,前两天偶有咳嗽一两声,今天早上明显感觉有点加重。我半躺着,摸摸孩子的头。 这时从隔壁...

  • 50/50法则

    这两天看到50/50法则,原来只是运用在投资资产配置上面,作为一个投资者做好自己账户管理,一般债券,一半股票和基金...

  • 50对50

    我怎么如此幸运-重生126-戴红霞(2021-01-02) 我怎么如此幸运-50对50 1.我怎么如此幸运意想不到...

  • 六、午时茶颗粒

    午时茶颗粒《中国药典》 【组成】苍术50g 柴胡50g 羌活50g 防风50g 白芷50g 川芎50g 广藿香50...

  • 无标题文章

    祎天作品 花卉50*60 花卉50*60 花卉50*60 花卉50*60 花卉50*60 ! 花卉 牧归24*24...

网友评论

      本文标题:Python-46~50

      本文链接:https://www.haomeiwen.com/subject/kwfemktx.html