How would I create a option for the total number of patients per doctor?
for example if I have a list of doctors to print each of their names & print the amount of patients assigned to them in integer format?
so it could like like:
John Smith has 5 patients
Tarn test has 1 patient
Terry hi has 0 patients
etc
I acknowledge printing the list of doctors would be required
then linking the patients to that list in a way(which is what i dont understand)
then printing it with a format
I’ve had an attempt at this too, which resulted in :
John Smith has 3 patients
Jone Smith has 3 patients
Jone Carlos has 3 patients
it stays at 3 and doesn’t change at all.
the code for this was:
print(‘\n’.join(
f"{doctor.full_name()} has {len(patients)} patients"
for doctor in doctors
))
is there a way for me to list out just the full names of the doctors with how many patients are assigned to them?
But at the same time, that doesn’t list it for each doctor, also the doctors names arent appearing which im unsure as to why
these are my few classes, admin is where i am writing this code
I’ve got another class called main where i store the list of doctors & patients information
admin: from Doctor import Doctorclass Admin: def __init__(self, username, pass - Pastebin.com
Doctor: class Doctor: def __init__(self, first_name, surname, speciality): - Pastebin.com