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
icon
Related questions
Question

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.

### 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.
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.
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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Stack
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education