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:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 17PE
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr