class Doctor(object):
def __init__ (self, name, weekdays=None, weekend=None):
self.name=name
self.weekdays=weekdays
self.weekend=weekend
def set_weekdays(self,weekdaysshift):
self.weekdays=weekdaysshift
def set_weekend(self,weekendshifts):
self.weekend=weekendshifts
def get_name(self):
return self.name
def get_weekdaysshift(self):
return self.weekdays
def get_weekendshifts(self):
return self.weekend
def __str__(self):
return 'Doctor: {}'.format str((self.name))
Hi, I'm new to Python and just learning it for the last two months and I was wondering if I can write a script to create monthly duty/shift list. I have no problem creating a class and istances but I was wondering if I can create instances of the class based on user input.
So when I write my script it should be something like that:
Name of the doctor:
Shifts in weekdays:
Shifts on weekend:
and use that user input to create an instance of the class.
This is not an exact duplicate of a previosly asked question. There must be a way to create an instance without using dictionary and add it to dictionary if user wants multiple instances.
Thanks for the help :)