Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Improvement
#2
My first thought is to have a single class (Animal) and a single input function. If all the different types of information and inputs can be stored in dictionaries thus:
nutrition = {1 : "Carnivorous",
             2 : "Herbivorous",
             3 : "Omnivorous",
             4 : "No Information",
             input_text : """Please Enter Nutrition Type
                          1. Carnivorous
                          2. Herbivorous
                          3. Omnivorous 
                          4. No Information"""} 
Then if you put all those dictionaries in to another one (eg, Animal.info_dict) then you can have all these inputs as part of the __init__ for the single animal class.
Reply


Messages In This Thread
Class Improvement - by Gokberk - Apr-18-2020, 09:58 AM
RE: Class Improvement - by michael1789 - Apr-18-2020, 05:34 PM
RE: Class Improvement - by Gokberk - Apr-19-2020, 09:25 AM
RE: Class Improvement - by michael1789 - Apr-19-2020, 08:13 PM
RE: Class Improvement - by Gokberk - Apr-19-2020, 10:16 PM

Forum Jump:

User Panel Messages

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