Question
*TO BE SOLVED IN PYTHON WITHOUT DATETIME MODULE A typical data entry will look like this: Student_Name , Crossing (can be ENTER or EXIT),
*TO BE SOLVED IN PYTHON WITHOUT DATETIME MODULE
A typical data entry will look like this: "Student_Name, Crossing (can be ENTER or EXIT), Gate-number, Time (in 24 hr format)
If in the record, a student is shown to enter even if he had previously entered the campus, i.e., two ENTER entries before EXIT, take the first one. Similarly, there can be two consecutive EXIT entries from the campus for a student - if so, take the last one. You are given the data for one day (A sample data file can be downloaded from File). If for a student there is EXIT but there is no ENTRY - it means he/she came the day before; similarly if ENTRY but no EXIT, it means that the student will leave next day. To avoid special situations, it is best if you first sort this data w.r.t time.
Note: Use of inbuilt libraries like datetime, etc. is not allowed.
Convert this data into a nested dictionary. The keys should be the name and value should be another dictionary containing a list of gate no, crossing type, time. Use this dictionary to answer the following queries (for querying, you can write a small loop and ask for a number between 1 and 3 - nothing given can be the end).
Given a student name (as input), show the record of students moving in/out of campus (as a list of tuples) in the day (in a output text file), and whether currently present in campus or not. Take another input for current time as well.
Given the start time and the end time (in 24hr format) as input, determine all the students who entered the campus during this, and all students who exited the campus during this time. Save the result into an output text file, with the format similar as the input data file.
Given the gate number (as input), determine the number of times students have entered the campus through that gate, and the number of times students have exited the campus from that gate.
text file for the data-
TA, Crossing, Gate number, Time Sahil Goyal, ENTER, 3, 00:00:01 Bhavya Jain, EXIT, 5, 00:00:04 Thanmayee Matha, ENTER, 1, 00:00:05 Khushdev Pandit, ENTER, 5, 00:00:17 Khushdev Pandit, EXIT, 1, 00:00:20 Khushdev Pandit, ENTER, 1, 00:00:45 Rohan Dhar, EXIT, 1, 00:00:50 Khushdev Pandit, EXIT, 1, 00:00:51 Bharat Goyal, EXIT, 1, 00:00:59 Khushdev Pandit, ENTER, 3, 00:01:05 Snehal, EXIT, 1, 00:01:14 Khushdev Pandit, EXIT, 5, 00:01:17 Khushdev Pandit, ENTER, 5, 00:01:31 Thakkar Divyakumar Rameshbhai, ENTER, 3, 00:01:31 Aryan Chaudhary, ENTER, 1, 00:01:43 Karan Baboota, ENTER, 5, 00:02:07 Smiti Singhal, EXIT, 1, 00:02:27 Shambhavi Sharma, ENTER, 5, 00:02:37 Khushdev Pandit, EXIT, 1, 00:02:38 Khushdev Pandit, ENTER, 3, 00:02:48 Khushdev Pandit, EXIT, 1, 00:03:06 Snehal, ENTER, 5, 00:03:06 Rishabh Oberoi, ENTER, 1, 00:03:07 Kartik Gupta, EXIT, 3, 00:03:17 Khushdev Pandit, ENTER, 5, 00:03:27 Khushdev Pandit, EXIT, 5, 00:03:44 Sushil Kumar, EXIT, 3, 00:03:48 Aryan Chaudhary, EXIT, 1, 00:03:58 Gayam Shivakanth Reddy, EXIT, 5, 00:04:13 Khushdev Pandit, ENTER, 5, 00:04:14 Khushdev Pandit, EXIT, 5, 00:04:24 Manas, ENTER, 5, 00:04:29 Aditya Raj Singh, EXIT, 1, 00:04:33 Swaib Ilias Mazumder, ENTER, 1, 00:04:33 Swaib Ilias Mazumder, EXIT, 3, 00:04:35 Vamshi Krishna Vannekala, ENTER, 1, 00:04:43 Khushdev Pandit, ENTER, 5, 00:04:57 Anuj Yadav, EXIT, 5, 00:05:02 Aditya Raj Singh, ENTER, 1, 00:05:23 Khushdev Pandit, EXIT, 1, 00:05:34 Vamshi Krishna Vannekala, EXIT, 3, 00:05:42 Shambhavi Sharma, EXIT, 3, 00:05:52 Shraman Jain, ENTER, 1, 00:06:12 Khushdev Pandit, ENTER, 1, 00:06:28 Khushdev Pandit, EXIT, 3, 00:06:33 Vibhor Agarwal, ENTER, 1, 00:06:52 Kartik Gupta, ENTER, 3, 00:07:03 Khushdev Pandit, ENTER, 5, 00:07:15 Khushdev Pandit, EXIT, 1, 00:07:23 Surbhi Goyal, EXIT, 1, 00:07:44 Vibhor Agarwal, EXIT, 3, 00:08:21 Khushdev Pandit, ENTER, 1, 00:08:32 Khushdev Pandit, EXIT, 5, 00:08:33 Thakkar Divyakumar Rameshbhai, EXIT, 1, 00:08:42Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started