+1 (315) 557-6473 

Designing a Building Entrance Tracker in Python assignment help

Due to Covid-19, the number of people inside a building should be limited to only 5 visitors. In this assignment, our Python assignment help solver create a program to help organize and register visitors in and out of the building. Each visitor must register when entering, and if the number of people inside the building is less than the limit, the visitor can enter; otherwise, you will receive a message advising you to wait for someone else to leave the building before entering. Each visitor must notify her departure by her name. If the name indicated is not within the list of people in the building, a message should be displayed indicating this. The menu should offer the option of generating a report that shows the number of current people in the building along with the name of each of them. In addition, it must show the average time (in minutes) that visitors last in the building.
Table Of Contents
  • Visitor Tracking Program

Visitor Tracking Program

# First, we define a list where the staff names will be stored staff =list() time_spent=list() # We define a variable for our main while-loop stop =False # Variable that tracks the state of the conversation talk_state=-1 # Start the main loop whilenot stop: iftalk_state==-1: # display menu print("Building Entrance Management") print("============================") print("1- Sign In") print("2- Sign Out") print("3- Report") print("0- Quit") # Now, we will start a second loop to check that the user enters a valid option valid_option=False whilenotvalid_option: choice =input("Choice? ") ifchoice.isnumeric() andint(choice) >=0andint(choice) <=3: # the option is numeric and is also between 0 and 3 talk_state=int(choice) valid_option=True else: print("Please enter a valid option.") eliftalk_state==0: # Quit iflen(staff) >0: print("There are still "+len(staff) +" person(s) in the building\n") valid_option=False whilenotvalid_option: choice =input("Are you sure you would like to exit the program? (y/n) ") if choice =='y': valid_option=True stop =True print("Good bye!") elif choice =='n': valid_option=True talk_state=-1 else: print("Please enter a valid option.") eliftalk_state==1: # Sign In name =input("Name: ") iflen(staff) ==5: print("Cannot allow more than 5 people!") else: staff.append(name) print("Entrance allowed!") talk_state=-1 eliftalk_state==2: # Sign out name =input("Name: ") if name in staff: # The entered name is present in the staff # Calculate time spent in minutes foridx, name_ inenumerate(staff): if name_ == name: time_min=input("Time Spent (in Minutes): ") time_spent.append(int(time_min)) print(name +" exited the building.") staff.remove(name) break else: print("This person is not in the building!") talk_state=-1 eliftalk_state==3: # Report print("There are "+str(len(staff)) +" person(s) in the building.") avg =0 iflen(staff) >0: foridx, name inenumerate(staff): print(str(idx+1) +" - "+ name) iflen(time_spent) >0: for mins intime_spent: avg += mins avg = avg/len(time_spent) print("People spend on average "+str(avg) +" minutes.") talk_state=-1 print("")