Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get variable
#3
i mean like this

class Food:
    def __init__(self, healthy=bool, type=str):
        self.healthy = healthy
        self.type = type
    def get_var(self):
        # code that will result in apple

apple = Food(True, 'fruit')
Reply


Messages In This Thread
how to get variable - by Azdaghost - Apr-22-2025, 06:55 PM
RE: how to get variable - by deanhystad - Apr-22-2025, 08:29 PM
RE: how to get variable - by Azdaghost - Apr-23-2025, 07:09 PM
RE: how to get variable - by deanhystad - Apr-23-2025, 07:43 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020