question archive A hospital is the most sensitive place from where the COVID case may increase
Subject:Computer SciencePrice:3.86 Bought11
A hospital is the most sensitive place from where the COVID case may increase. To maintain the social distancing, you are required to arrange seating of patients at a distance in the waiting area.
Patient need to provide his following details such as number, age, name. After providing details, an auto generated token number will be assigned to the patient for the appointment of the doctor.
A patient need to choose his seat number in between 1 to 50 in the waiting area to see the doctor.
In order to maintain SoPs, there should be the distance of two seats in between.
For example, if seat # 2 is occupied then seat # 3 and seat # 4 should be disabled to maintain social distancing.
You have to create multiple patient record, at least 10 patient and 2 doctors must be recorded.
Use any structure such as List, dictionary, sets, or tuple to maintain the record detail.
A hospital is the most sensitive place from where the COVID case may increase. To maintain the social distancing, you are required to arrange seating of patients at a distance in the waiting area.
Step-by-step explanation
Explanation:
----------------
class Patient:
token=0
def __init__(self,number,age,name):
self.__number=number
self.__age=age
self.__name=name
self.token=Patient.token
Patient.token+=1
print(Patient.token)
def set_number(self,number):
self.__number=number
def get_number(self):
return self.__number
def set_age(self,age):
self.__age=age
def get_age(self):
return self.__age
def set_name(self,name):
self.__name=name
def get_name(self):
return self.__name
def find_seat(self):
my_dict={}
my_list=[]
my_list.append(self.__number)
my_list.append(self.__age)
my_list.append(self.__name)
user_input=input("please enter seat number between 1 to 50")
seat=int(user_input)
if(seat>=0 and seat<=50):
if seat not in my_dict and (seat-1 and seat+1 not in my_dict) :
my_dict.update({Patient.token:my_list})
my_list=[]
return my_dict
p1=Patient(99999999,20,'a')
p2=Patient(99999998,20,'b')
p3=Patient(99999999,20,'c')
p4=Patient(99999998,20,'d')
p5=Patient(99999999,20,'e')
p6=Patient(99999998,20,'f')
p7=Patient(99999999,20,'g')
p8=Patient(99999998,20,'h')
p9=Patient(99999999,20,'i')
p10=Patient(99999998,20,'j')
print(p2.find_seat())