猫史档案馆


【Python作品分享】新的作品【作品秀】

用户:小可爱:小咕噜小可爱:小咕噜查看:3 回复:1 评论:3 创建时间:2021-02-21T18:20:21


【作品展示】

center_image

 

【作品介绍】

一个简单的热狗🌭烘焙机

 

【作品源代码】

# 男人
# import easygui
# import random


# class Man:
#     def __init__(self):
#         self.name = "憨憨"
#         self.color = "黑"

#     def pao():
#         print("我们都跑了100000000㎞!")


# oneMan = Man()
# towMan = Man()
# threeMan = Man()
# oneMan.year = 1
# towMan.year = 2
# threeMan.year = 3
# print(f"oneMan{oneMan.year}岁了,叫{oneMan.name},是{oneMan.color}人。")
# print(f"towMan{towMan.year}岁了,叫{towMan.name},是{oneMan.color}人。")
# print(f"threeMan{threeMan.year}岁了,叫{oneMan.name},是{oneMan.color}人。")
# Man.pao()
# times1 = random.randint(0, 10)
# times2 = random.randint(0, 10)

# 球
# class Ball():
#     def __init__(self, name, color, size):
#         self.name = name
#         self.color = color
#         self.size = size

#     def yellowBounce(self):
#         for i in range(times1):
#             print("啪", end=" ")
#         print("我拍了", times1, "下黄球")

#     def yellowThrow(self):
#         print("我把黄球扔出了", random.randint(1, 20), "米远")

#     def redBounce(self):
#         for i in range(times2):
#             print("啪", end=" ")
#         print("我拍了", times2, "下红球")

#     def redThrow(self):
#         print("我把红球扔出了", random.randint(1, 20), "米远")


# # 实例化两个球
# yellowBall = Ball("yellowBall", "yellow", 9)

# redBall = Ball("redBall", "red", 10)

# # 给yellowBall添加一个color属性。
# print("yellowBall的颜色是", yellowBall.color)
# print("redBall的颜色是", redBall.color)
# print()
# print("yellowBall的名字是", yellowBall.name)
# print("redBall的名字是", redBall.name)
# print()
# print("yellowBall的大小是", yellowBall.size, "厘米")
# print("redBall的大小是", redBall.size, "厘米")
# print()

# # 调用一下yellowBall的方法(拍球)
# yellowBall.yellowBounce()
# # 调用一下yellowBall的方法(扔出去)
# yellowBall.yellowThrow()

# print()
# # 调用一下redBall的方法(拍球)
# redBall.redBounce()
# # 调用一下redBall的方法(扔出去)
# redBall.redThrow()

# 热狗
time = 100


class HotDog:
    def __init__(self):
        self.cooked_lever = 0
        self.cooked_string = "生的"
        self.condiment = []

    def __str__(self):
        pass

    def cooked(self, time):
        self.cooked_lever += time
        if self.cooked_lever > 50:
            self.cooked_string = "机器烂了,赔∞比特币"
        elif self.cooked_lever > 8:
            self.cooked_string = "焦"
        elif self.cooked_lever > 5:
            self.cooked_string = "真香"
        elif self.cooked_lever > 3:
            self.cooked_string = "不好吃"
        elif self.cooked_lever < 3:
            self.cooked_string = "生"
        elif self.cooked_lever < 0:
            self.cooked_string = "-------------------------------------------------"

    def add_condiment(self):
        pass


my_hotdog = HotDog()
my_hotdog.cooked(-喵000000000000)

print(my_hotdog.cooked_lever)
print(my_hotdog.cooked_string)
print(my_hotdog.condiment)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
Mellin_AmpMellin_Amp

是从某本书上学习的吗?

好怀念啊....

点赞0


评论