Adding Parameters to the class

Adding Parameters to the class

 class Phone :

     def set_color(self,color):

        self.color = color

    def set_cost(self,cost):

        self.cost = cost

    def show_color(self):

        return self.color

    def show_cost(self):

        return self.cost

    def make_call (self):

        print("Making phone call")

    def play_game (self):

        print("Playing a game")

p2 = Phone()

p2.set_color("red")

p2.set_cost(39889)

p2.show_color()

out put

red

p2.show_cost()

out put

39899

p2.make_call()

out put

Making phone call

p2.play_game()

out put

Playing a game






Comments

Popular posts from this blog

What is chopper

What is Resistor

Top 5 best Ethical hacking book for beginners