Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve this according to the question in python language without using any module.And also explain the code in brief. This is a sample file.

image text in transcribed

Please solve this according to the question in python language without using any module.And also explain the code in brief.

This is a sample file.

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:42 Shraman Jain, EXIT, 5, 00:09:41 Shashank Dargar, ENTER, 1, 00:09:46 Khushdev Pandit, ENTER, 3, 00:10:21 Bharat Goyal, ENTER, 1, 00:10:55 Khushdev Pandit, EXIT, 5, 00:10:57 Shambhavi Sharma, ENTER, 5, 00:10:59 Bhavya Jain, ENTER, 5, 00:11:11 Smiti Singhal, ENTER, 3, 00:11:20 Param Shah, ENTER, 1, 00:11:37 Vibhor Agarwal, ENTER, 5, 00:12:29 Shraman Jain, ENTER, 5, 00:12:46 Khushdev Pandit, ENTER, 3, 00:12:50 Bhavya Jain, EXIT, 3, 00:12:51 Swatantra kumar nigam, ENTER, 5, 00:12:52 Khushdev Pandit, EXIT, 5, 00:13:08 Rishabh Oberoi, EXIT, 5, 00:13:11 Khushdev Pandit, ENTER, 1, 00:13:12 Ujjwal Garg, ENTER, 3, 00:13:17 Swati Jha, EXIT, 1, 00:13:21 Anuj Yadav, ENTER, 1, 00:13:22 Ayush Srivastava, ENTER, 5, 00:13:53 Rishabh Oberoi, ENTER, 5, 00:13:53 Khushdev Pandit, EXIT, 3, 00:14:25 Khushdev Pandit, ENTER, 5, 00:14:28 Shraman Jain, EXIT, 1, 00:14:35 Vibhor Agarwal, EXIT, 1, 00:14:46 Khushdev Pandit, EXIT, 5, 00:15:15 Khushdev Pandit, ENTER, 1, 00:15:28 Khushdev Pandit, EXIT, 3, 00:15:38 Khushdev Pandit, ENTER, 3, 00:15:38 Ujjwal Garg, EXIT, 3, 00:15:42 Gayam Shivakanth Reddy, ENTER, 1, 00:15:43 Khushdev Pandit, EXIT, 1, 00:15:45 Shraman Jain, ENTER, 5, 00:15:47 Sahil Goyal, EXIT, 5, 00:16:10 Thanmayee Matha, EXIT, 3, 00:16:10

For IIIT-D students living off-campus (we have used IP TA names for this), suppose records of whenever a student enters or exits the campus are maintained in a data file. A typical data entry will look like this: "Student_Name, Crossing (can be ENTER or EXIT), Gate-number, Time (in 24hr 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). 1) 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. 2) Given the start time and the end time (in 24hr format, both inclusive) 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. 3) 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions