小编Jpy*_*Jpy的帖子

Python手机类---打印无

class Phone:
    def __init__(self):
        self.types = ["Touch Screen","Flip", "Slider", "Bar", "Bag"]
        self.brand = "No Brand Determined"
        self.type_of_phone = "No Type of Phone has been selected"

    def get_type(self):
        return self.type_of_phone
    def change_type(self, changeTo):
        if self.check_type(changeTo):
            self.type_of_phone = changeTo
        else:
            print("The Type you wish to change the phone to is not a supported type.")

    def change_brand(self, changeTo):
        self.brand = changeTo


    def check_type(self, inQuestion):
        if inQuestion in self.types:
            return True
        return False
    def toString(self):
        return "Brand: "+self.brand+"\nType: "+self.type_of_phone+"\n"

    def menu(self):
        self.intro()
        while True: …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

2
推荐指数
1
解决办法
928
查看次数

标签 统计

python ×1

python-3.x ×1