【拉勾二期】python 实战(二)作业贴

罗海龙 作业二
https://github.com/lhlgxyf33/Lagou2QiHomework

窦晖_python直播课作业2

https://github.com/latesir/lagouLessonPython

https://github.com/anny2020/hogwarts.git

python 实战二作业
https://github.com/CandiceDiao/PythonProject.git

yml 使用

# -*- encoding: UTF-8 -*-
"""
@File    : workthree.py
@Time    : 2020-6-3 14:08
@Author  : Mokwing
@Email   : 1010326277@qq.com
@Software: PyCharm
@Message : 
"""
import yaml


class Animal:
    # 该 Animal 类拥有的属性
    def __init__(self, name, color, age, sex):
        self.name = name
        self.color = color
        self.age = age
        self.sex = sex

    def call(self):
        print("this animal can call.")

    def run(self):
        print("this animal can run.")


class Cat(Animal):
    def __init__(self, name, color, age, sex, hair="short hair"):
        super().__init__(name, color, age, sex)
        self.hair = hair

    def call(self):
        print("this cat can miao miao.")

    def work(self):
        print("this cat can catch mice.")
        print(f"{self.name} {self.color} {self.hair} {self.age} {self.sex} catch mice success.")


class Dog(Animal):
    def __init__(self, name, color, age, sex, hair="long hair"):
        super().__init__(name, color, age, sex)
        self.hair = hair

    def call(self):
        print("this cat can wang wang.")

    def work(self):
        print("this dog can watch the house.")
        print(f"{self.name} {self.color} {self.age} {self.sex} {self.hair}")


if __name__ == '__main__':
    # 使用yml
    with open("animal.yml") as f:
        data = yaml.safe_load(f)

    cat_data = data["cat"]
    cat = Cat(cat_data["name"], cat_data["color"], cat_data["age"], cat_data["sex"])
    cat.work()

    dog_data = data["dog"]
    dog = Dog(dog_data["name"], dog_data["color"], dog_data["age"], dog_data["sex"])
    dog.work()

github 已更新。

王明哲python实战(一)(二)作业
https://github.com/WMZ5123/Lagou2QiProject

已修改。新增 animail.yml 文件,修改init方法和调用方法

董淑琳 作业2
https://github.com/dongshulin222/LagouPython

李新新-python实战(二) 作业

1、 自己写一个面向对象的例子-见-pythonCode-homework002 https://github.com/lixinxin2019/LaGou2Q.git
2、使用 yaml 来管理实例的属性:已补充

https://github.com/ljwaaa/lagou2qiproject.git

Guocheng-python实战作业1和2
https://github.com/sidneyharris/Python_homework

陈雪——python实战课二作业

https://github.com/urnotchris0525/TestProject/tree/master/pythonTestTwo

郑琳
python实战二作业

https://github.com/zhangwanli-marker/Lagouzuoye/blob/master/pythoncode/Lagouzuoye/python实战2作业.py

https://github.com/zr9796/LaGou2Homework/blob/master/pythoncode/Animal.py

王熙曈作业
https://github.com/wxt-hhh/lagou-hogwarts/tree/master/pythoncode

拉钩二期实战作业

https://github.com/en-one/cekai_pythoncode.git
087646学员

#匡志荣python实战二作业
https://github.com/King-Zeno/TestDevelopment/tree/master/ClassEx

陈智斌_python实战(作业)提交
https://github.com/archerckk/hogwarts/tree/master/python_hw

张东惠作业
https://github.com/442920785qqcom/lagouerqiproject.git