Write a function contact_event (visit_a, visit_b) to determine if two visits overlap in time and space, allowing for contact between two people to potentially occur. The parameters of this function are as follows: • visit_a • visit_b each of which is a 7-tuple formatted as described above. The function should return True if a contact could have occurred between two distinct people, and False otherwise. If one visit began at the exact time that the other visit ended, you may assume that a potential contact could not occur (ie, the function should return False). If either of the visits is not valid, the function should return None. Assumptions: You can assume that the input arguments are syntactically correct given the definitions and assumptions on the previous slides. Here are some example calls to the function:

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
Write a function contact_event (visit_a, visit_b) to determine if two visits overlap in time and space, allowing for contact between two people to potentially
occur.
The parameters of this function are as follows:
• visit_a
• visit_b
each of which is a 7-tuple formatted as described above.
The function should return True if a contact could have occurred between two distinct people, and False otherwise. If one visit began at the exact time that the other
visit ended, you may assume that a potential contact could not occur (ie, the function should return False). If either of the visits is not valid, the function should return
None.
Assumptions:
• You can assume that the input arguments are syntactically correct given the definitions and assumptions on the previous slides.
Here are some example calls to the function:
>>> print(contact_event(('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Natalya', 'Foodigm', 2, 9, 30, 9, 45)))
True
>>> print(contact_event(('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Natalya', 'Foodigm', 2, 10, 0, 10, 20)))
False
>>> print(contact_event ( ("Natalya", 'Foodigm', 2, 9, 30, 9, 45), ('Chihiro', 'Foodigm', 2, 8, 45, 9, 15))) # there is no time overlap
False
>>> print(contact_event (('Russel', 'Foodigm', 2, 9, 0, 1e, 0), ('Aravinda', 'Afforage', 2, 9, 0, 10, 0))) # the two visit were to diffi
False
>>> print(contact_event (('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Russel', 'Foodigm', 2, 8, 30, 9, 0))) # the two visits are by the same
False
>>> print (contact_event ((' Russel', 'Foodigm', 2, 9, o, 10, 0), ('Natalya', 'Afforage', 2, 15, 10, 14, 45))) # one of the visits is inva
None
Transcribed Image Text:Write a function contact_event (visit_a, visit_b) to determine if two visits overlap in time and space, allowing for contact between two people to potentially occur. The parameters of this function are as follows: • visit_a • visit_b each of which is a 7-tuple formatted as described above. The function should return True if a contact could have occurred between two distinct people, and False otherwise. If one visit began at the exact time that the other visit ended, you may assume that a potential contact could not occur (ie, the function should return False). If either of the visits is not valid, the function should return None. Assumptions: • You can assume that the input arguments are syntactically correct given the definitions and assumptions on the previous slides. Here are some example calls to the function: >>> print(contact_event(('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Natalya', 'Foodigm', 2, 9, 30, 9, 45))) True >>> print(contact_event(('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Natalya', 'Foodigm', 2, 10, 0, 10, 20))) False >>> print(contact_event ( ("Natalya", 'Foodigm', 2, 9, 30, 9, 45), ('Chihiro', 'Foodigm', 2, 8, 45, 9, 15))) # there is no time overlap False >>> print(contact_event (('Russel', 'Foodigm', 2, 9, 0, 1e, 0), ('Aravinda', 'Afforage', 2, 9, 0, 10, 0))) # the two visit were to diffi False >>> print(contact_event (('Russel', 'Foodigm', 2, 9, 0, 10, 0), ('Russel', 'Foodigm', 2, 8, 30, 9, 0))) # the two visits are by the same False >>> print (contact_event ((' Russel', 'Foodigm', 2, 9, o, 10, 0), ('Natalya', 'Afforage', 2, 15, 10, 14, 45))) # one of the visits is inva None
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Variables
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
  • SEE MORE 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