Question

PYTHON The program needs to process the arrival and departure of each patient documented in the...

PYTHON

The program needs to process the arrival and departure of each patient documented in the patient data file. While processing each patient, send the following output to an output file:

a.Use your two new functions to initially print out a "0".

b. As each patient arrives, print out the name of the patient & the time that they arrive at.

c. Update the billboard counter to indicate that the wait time has increased.

d. Print out the new billboard seven segment digit value using 7 lines of output.

e.Every time a patient checks out of the hospital, print out the name of the patient and the time that they are leaving.

f. Update the billboard counter to indicate that the wait time has decreased.

g. Print out the new billboard seven segment digit value using 7 lines of output.

h. Continue until all of the patients in the input data file have checked out.

Your program is going to be responsible for determining how many people are being helped by the hospital during the day.The fancy new billboard that the hospital has purchased has a single seven segment digit that can display the wait time that an arriving patient can expect. Each time a patient arrives at the hospital, this number needs to be incremented by one. Possible values are 0-9. You are going to have to create two functions in order to interface with the billboard.

The name of the data file to be used with this is "HW #4 patient data.txt"

You are going to have to read in each patient patient's record, break it into its individual components,and then create a Python list that contains the complete patient record j

the content of the text file is bellow

'Johnson', 'Fred', 'N', '2763 Filibuster Drive', 'Lakeland', 'FL', '37643', 'M', '05/27/1935', '164-55-0726', '06:05', '23:05'
'Beard', 'Cindy', 'J', '1814 Constitution Ct', 'Orlando', 'FL', '31234', 'F', '05/28/1997', '879-61-1829', '20:10', '21:10'
'Chaname', 'Bryan', 'D', '24 Blue Belt Drive', 'Lakeland', 'FL', '32643', 'M', '02/23/2000', '741-85-9632', '23:15', '23:30'
'Williams', 'Betty', 'L', '701 Collage Avenue', 'Orlando', 'FL', '31234', 'F', '11/27/1971', '948-44-1038', '08:20', '12:15'
'Calderon', 'Yamil', 'C', '345 Cigar Row', 'Tampa', 'FL', '32785', 'M', '04/07/1998', '123-87-0000', '21:25', '22:30'
'Carter', 'Thomas', 'P', '896 Pine Avenue', 'Tampa', 'FL', '32785', 'M', '03/12/1999', '248-65-3197', '22:30', '24:00'
'Albin', 'Ross', 'L', '207 Daisy Avenue', 'Lakeland', 'FL', '32643', 'M', '12/08/1990', '458-57-2867', '11:35', '16:25'
'Baca', 'Elisa', 'L', '25 Hunters Lane', 'Lakeland', 'FL', '32643', 'F', '10/30/1992', '159-56-9731', '14:40', '17:30'
'Birner', 'Dalton', 'M', '851 Applebe Court', 'Orlando', 'FL', '31234', 'M', '09/22/1993', '695-21-2340', '15:45', '20:35'
'Dominguez', 'Javier', 'B', '1410 Waterford Blvd', 'Orlando', 'FL', '31234', 'M', '08/04/1994', '753-66-6482', '16:50', '21:40'
'Aimino', 'Ann', 'S', '2379 Runners Way', 'Lakeland', 'FL', '32643', 'F', '07/11/1995', '852-73-4196', '17:55', '18:45'
'Armstrong', 'Addison', 'T', '46 Hawthorne Drive', 'Lakeland', 'FL', '32643', 'M', '06/18/1996', '648-81-1456', '18:00', '22:50'
'Ling', 'Hector', 'X', '1500 Raceway Lane', 'Tampa', 'FL', '32785', 'M', '10/17/2003', '193-74-0274', '10:05', '12:55'
'Anderson', 'Jason', 'O', '1527 Lewis Road', 'Tampa', 'FL', '32785', 'M', '11/25/1991', '093-00-1093', '12:10', '14:05'
'Chaney', 'Kris', 'Z', '2589 College Court', 'Orlando', 'FL', '31234', 'F', '01/15/2001', '963-25-7418', '23:25', '23:50'

So I have already created the functions for the billboard I just Need help with turning the text file into a list to then make a patientCounter and organize the times of each patient

# Function for billboard numbers

def setDisplayNum(displayDigit) :
if displayDigit == 0:
displayNumDigit = [[1],[1,1],[0],[1,1],[1]]
if displayDigit == 1:
displayNumDigit = [[0],[0,1],[0],[0,1],[0]]
if displayDigit == 2:
displayNumDigit = [[1],[0,1],[1],[1,0],[1]]
if displayDigit == 3:
displayNumDigit = [[1],[0,1],[1],[0,1],[1]]
if displayDigit == 4:
displayNumDigit = [[0],[1,1],[1],[0,1],[0]]
if displayDigit == 5:
displayNumDigit = [[1],[1,0],[1],[0,1],[1]]
if displayDigit == 6:
displayNumDigit = [[1],[1,0],[1],[1,1],[1]]
if displayDigit == 7:
displayNumDigit = [[1],[0,1],[0],[0,1],[0]]
if displayDigit == 8:
displayNumDigit = [[1],[1,1],[1],[1,1],[1]]
if displayDigit == 9:
displayNumDigit = [[1],[1,1],[1],[0,1],[1]]
return(displayNumDigit)

# Function for actually displaying number on billboard

def displayDigit(digiParts):
for i in digiParts:
if (len(i)) == 1:
if(i[0]) == 1:
print(" ______ ", file = outFile)
if(i[0]) == 0 :
print(" ", file = outFile)
if (len(i)) == 2:
if (i[0]) == 0 and (i[1]) == 0:
print(" ", file = outFile)
print(" ", file = outFile)
if (i[0]) == 0 and (i[1]) == 1:
print(" |", file = outFile)
print(" |", file = outFile)
if (i[0]) == 1 and (i[1]) == 0:
print("| ", file = outFile)
print("| ", file = outFile)
if (i[0]) == 1 and (i[1]) == 1:
print("| |", file = outFile)
print("| |", file = outFile)

# Opening file with patient records and ouputfile

patientInfile = open("C:/Users/owner/Downloads/HW #4 patient data.txt","r")
outFile = open("output.txt","w")

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans:

# The Program mentioned below is as per the requirements of what you have mentioned

# Below is the input given to the file

# the program below is what is to be required

patientInfile = open("C:/Users/owner/Downloads/HW #4 patient data.txt","r")# for reading the input file in read mode
lst = []# final list which stores the data of each patient in the form of another list of various fields mentioned
for line in patientInfile:# this loop reads each line in the patientInfile
temp = line.split(',')# this is to break the patient values at every ',' character
s = []# another list to store the intermediate result
for i in temp:
s.append(i.replace("'",""))# for replacing the "'" character
lst.append(s)
  
for i in lst:
print(i)
outFile = open("output.txt","w") # to open file output and write in the file
for i in lst:# writing the ouput for every element in the lst
outFile.write("patient name : "+str(i[1])+" "+str(i[0])+" , Arrival : "+str(i[-2])+" , Departure : "+str(i[-1]))snip
# add this in the main function after the two functions

# below is the output after writing it to an output file

# PLEASE DO LIKE AND UPVOTE IF THIS WAS HELPFUL

# THANK YOU SO MUCH IN ADVANCE!

Add a comment
Know the answer?
Add Answer to:
PYTHON The program needs to process the arrival and departure of each patient documented in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python, given a code in class i just need help with the third bullet point ; using a and n (defin...

    Python, given a code in class i just need help with the third bullet point ; using a and n (defined in the second picture of python code) find the first digit for k! for k =1,...,n. you dont have to type in all this code just help me write the code in the first picture where it says: def benford(a): b = [0 for d in range(1,10)] #Do everthything in here return b 2.2 Generating data In this assignment...

  • I'm making a To-Do list in Python 2 and had the program running before remembering that...

    I'm making a To-Do list in Python 2 and had the program running before remembering that my professor wants me to put everything in procedures. I can't seem to get it to work the way I have it now and I can't figure it out. I commented out the lines that was originally in the working program and added procedures to the top. I've attached a screenshot of the error & pasted the code below. 1 todo_list = [] 2...

  • Programming in C. Name this program schwifty.c - This program reads a text file and makes...

    Programming in C. Name this program schwifty.c - This program reads a text file and makes it schwifty, but the user determines the schwiftiness. The user supplies the filename to schwift and a string containing a sequence of the following characters to determine the schwiftiness via command line arguments: L - Left shift each character in a word: hello --> elloh R - Right shift each character in a word: elloh --> hello I - Shift the letters' and digits'...

  • The ", delimiter" should now be changed to use the "^ delimiter". There needs to be...

    The ", delimiter" should now be changed to use the "^ delimiter". There needs to be an 2nd address field added to the original code, as well as, a "plus 4" on the zip code (example: 47408-6606). Then the additional prompts must be added. Thank you! Last Real-World problem (in module 04 - 05), you added functionality to allow the user to enter multiple patients until the user indicated done. You are to enhance this functionality. Add the following functionality...

  • In Python !!! In this exercise you will continue to work with Classes and will build...

    In Python !!! In this exercise you will continue to work with Classes and will build on the Book class in Lab 13.10; you should copy the code you created there as you will need to extend it in this exercise. You will extend the Book class to accommodate the case where there may be multiple authors for a book. The attribute author should become a list. The constructor will still take a parameter that is a string for author,...

  • Python program This assignment requires you to write a single large program. I have broken it...

    Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...

  • Please can someone help me to finish this program? It is a C programming not a...

    Please can someone help me to finish this program? It is a C programming not a C++, when programming the program in linux I keep getting expected expression before || token, also please check if everything else is fine, maybe there is something else worng in my program and may ask me later to fix it, I am concern about the sin and cosine. The program is supposed to do all this: 1.Display a welcome message. 2.Prompt for the height...

  • Python Problem, just need some guidance with the description, pseudocode and run time. I believe this...

    Python Problem, just need some guidance with the description, pseudocode and run time. I believe this is an 0-1 knapsack problem? Shopping Spree: (20 points) Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example,...

  • exploration of cranialne U s patient who modifier is used for interpretation of a testres A....

    exploration of cranialne U s patient who modifier is used for interpretation of a testres A. 61458-53 B. 61458-54 C. 61458-55 D. 61458-56 4. What modifier is used for in A. Radiology service B. Global service C. Professional component D. Technical component 5. What is the format of CPT modifiers? A. Two numbers B. Two letters C. One letter and one number D. One letter and one symbol KEEP ON CODING fortable in this chapters Instructions. Read the modifier definition...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT