PYTHON PROGRAMMING ONLY PLZ( USING STACKS AND QUEUES)(DO NOT JUST PRINT THE RAW LIST MUST BE IN A STACK) my code and an example of a stack will be below just need help a little confused. Write a small program that simulates a doctor's Office. Your office will perform the following tasks Keep track of the waiting list using a queue Keep track of what checks need to happen to each person in a stack (check temperature, check weight, etc..). Your program will Ask the patient for their name. (you will store this data in a queue) (You must have at least 4 names in your queue before calling them to the doctor) Ask the customers what brings them in today Display to the console You will show your patients being called to the doctor and the queue changing. Describe your queue do not just print the raw list You will show the doctor administering the checks in the stack and your stack being updated. Describe your stack do not just print the raw stack How you create the doctor's office and show the above criteria is up to you. I want to see your individual design of the application. As long as you implement all the requirements above.
PYTHON PROGRAMMING ONLY PLZ( USING STACKS AND QUEUES)(DO NOT JUST PRINT THE RAW LIST MUST BE IN A STACK) my code and an example of a stack will be below just need help a little confused. Write a small program that simulates a doctor's Office. Your office will perform the following tasks Keep track of the waiting list using a queue Keep track of what checks need to happen to each person in a stack (check temperature, check weight, etc..). Your program will Ask the patient for their name. (you will store this data in a queue) (You must have at least 4 names in your queue before calling them to the doctor) Ask the customers what brings them in today Display to the console You will show your patients being called to the doctor and the queue changing. Describe your queue do not just print the raw list You will show the doctor administering the checks in the stack and your stack being updated. Describe your stack do not just print the raw stack How you create the doctor's office and show the above criteria is up to you. I want to see your individual design of the application. As long as you implement all the requirements above.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
PYTHON
Write a small program that simulates a doctor's Office.
Your office will perform the following tasks
- Keep track of the waiting list using a queue
- Keep track of what checks need to happen to each person in a stack (check temperature, check weight, etc..).
Your program will
- Ask the patient for their name. (you will store this data in a queue) (You must have at least 4 names in your queue before calling them to the doctor)
- Ask the customers what brings them in today
Display to the console
- You will show your patients being called to the doctor and the queue changing.
- Describe your queue do not just print the raw list
- You will show the doctor administering the checks in the stack and your stack being updated.
- Describe your stack do not just print the raw stack
How you create the doctor's office and show the above criteria is up to you. I want to see your individual design of the application. As long as you implement all the requirements above.
![### Creating a Stack in Python
A stack is a data structure that follows the Last In First Out (LIFO) format. This means the last element added to the stack will be the first one to be removed.
#### Code Explanation
1. **Initialize an Empty List as a Stack:**
```python
myStack = []
```
2. **Add Data to the Stack:**
```python
myStack.append('A')
myStack.append('B')
myStack.append('C')
myStack.append('D')
```
3. **Print the Raw Stack:**
This line prints the current state of the stack to show all elements inside it.
```python
print(myStack)
```
4. **Print Stack in a Formatted Manner:**
The `printStack` function displays each element of the stack with its position:
```python
def printStack(myStack):
count = 1
for items in myStack:
print(f'{count} - {items}\n')
count += 1
```
- **Call the Print Function:**
```python
printStack(myStack)
```
5. **Remove an Item from the Stack:**
The `pop` method is used to remove the last item entered (Last In First Out):
```python
print('-remove an item from stack (last in first out)-')
myPopedItem = myStack.pop()
printStack(myStack)
```
This code demonstration efficiently shows how to implement a basic stack using Python’s list data structure, including adding, viewing, and removing elements.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7cef3050-b0aa-40af-9112-57cab04a18ba%2Ff198571d-2937-4ffe-9ba4-52f9fc0e7f15%2Fx0gokaa_processed.jpeg&w=3840&q=75)
Transcribed Image Text:### Creating a Stack in Python
A stack is a data structure that follows the Last In First Out (LIFO) format. This means the last element added to the stack will be the first one to be removed.
#### Code Explanation
1. **Initialize an Empty List as a Stack:**
```python
myStack = []
```
2. **Add Data to the Stack:**
```python
myStack.append('A')
myStack.append('B')
myStack.append('C')
myStack.append('D')
```
3. **Print the Raw Stack:**
This line prints the current state of the stack to show all elements inside it.
```python
print(myStack)
```
4. **Print Stack in a Formatted Manner:**
The `printStack` function displays each element of the stack with its position:
```python
def printStack(myStack):
count = 1
for items in myStack:
print(f'{count} - {items}\n')
count += 1
```
- **Call the Print Function:**
```python
printStack(myStack)
```
5. **Remove an Item from the Stack:**
The `pop` method is used to remove the last item entered (Last In First Out):
```python
print('-remove an item from stack (last in first out)-')
myPopedItem = myStack.pop()
printStack(myStack)
```
This code demonstration efficiently shows how to implement a basic stack using Python’s list data structure, including adding, viewing, and removing elements.
![```python
# List of patients
Patients = ['John', 'Paul', 'George', 'Ringo']
# List of medical checks to be performed
Checks = ['temperature', 'weight', 'blood pressure', 'pulse']
# Initial message indicating the doctor's office is open
print('Doctor\'s office')
# Welcome message in the waiting room
print('Waiting room')
# Loop through each patient to seat them in the waiting room
for i in range(len(Patients)):
print('Please take a seat,', Patients[i])
# Message indicating the doctor will see the patients soon
print('Doctor will see you shortly')
# Process each patient for their medical checks
for i in range(len(Patients)):
print('Please follow me,', Patients[i]) # Patient is called for checks
# Perform each check for the current patient
for j in range(len(Checks)):
print('Checking', Checks[j], 'for', Patients[i])
# Completion message for the patient
print('All done,', Patients[i], 'thank you for your visit')
# Final message indicating the doctor's office is closed
print('Doctor\'s office is now closed')
```
### Explanation
This Python script simulates the process of attending to patients in a doctor's office. It includes a list of patients and a set of medical checks. The program prints messages guiding the patients through seating, medical checks, completion of the process, and finally, closure of the office.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7cef3050-b0aa-40af-9112-57cab04a18ba%2Ff198571d-2937-4ffe-9ba4-52f9fc0e7f15%2F5drxuk7_processed.jpeg&w=3840&q=75)
Transcribed Image Text:```python
# List of patients
Patients = ['John', 'Paul', 'George', 'Ringo']
# List of medical checks to be performed
Checks = ['temperature', 'weight', 'blood pressure', 'pulse']
# Initial message indicating the doctor's office is open
print('Doctor\'s office')
# Welcome message in the waiting room
print('Waiting room')
# Loop through each patient to seat them in the waiting room
for i in range(len(Patients)):
print('Please take a seat,', Patients[i])
# Message indicating the doctor will see the patients soon
print('Doctor will see you shortly')
# Process each patient for their medical checks
for i in range(len(Patients)):
print('Please follow me,', Patients[i]) # Patient is called for checks
# Perform each check for the current patient
for j in range(len(Checks)):
print('Checking', Checks[j], 'for', Patients[i])
# Completion message for the patient
print('All done,', Patients[i], 'thank you for your visit')
# Final message indicating the doctor's office is closed
print('Doctor\'s office is now closed')
```
### Explanation
This Python script simulates the process of attending to patients in a doctor's office. It includes a list of patients and a set of medical checks. The program prints messages guiding the patients through seating, medical checks, completion of the process, and finally, closure of the office.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education