Write a function visit_length (visit) to determine the length of a person's visit to a particular location. The function takes one argument, visit, which is a 7-tuple formatted as described above. The function should return the length of the visit as a tuple of integer values, corresponding to hours and minutes if the visit is valid, or None if the visit is not valid. A valid visit is one with a positive length (ie, more than zero minutes). For example, visit_length(("Irene", "Skylabs", 3, 9, 15, 13, 45)) (4, 30) which means that Irene spent 4 hours and 30 minutes at Skylabs from 9:15am to 1:45pm on the third day of the outbreak. 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(visit_length(('Russel', 'Foodigm', 2, 9, e, 10, e))) (1, 0) >>> print(visit_length(('Natalya', 'Foodigm', 2, 9, 30, 9, 45))) (e, 15) >>> print(visit_length(('Chihiro', 'Foodigm', 2, 8, 45, 9, 15))) (в, з0) >>> print(visit_length(('Aravinda', 'Afforage', 2, 9, e, 10, 0))) (1, e) >>> print(visit_length(('Chihiro', 'Foodigm', 2, 8, 30, 9, e))) (0, зе) >>> print(visit_length(('Natalya', 'Afforage', 2, 15, 10, 14, 45))) * the length of the visit is negative None >>> print(visit_length(('Aravinda', 'Nutrity', 2, 15, 10, 15, 10))) # the length of the visit is zero None
Write a function visit_length (visit) to determine the length of a person's visit to a particular location. The function takes one argument, visit, which is a 7-tuple formatted as described above. The function should return the length of the visit as a tuple of integer values, corresponding to hours and minutes if the visit is valid, or None if the visit is not valid. A valid visit is one with a positive length (ie, more than zero minutes). For example, visit_length(("Irene", "Skylabs", 3, 9, 15, 13, 45)) (4, 30) which means that Irene spent 4 hours and 30 minutes at Skylabs from 9:15am to 1:45pm on the third day of the outbreak. 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(visit_length(('Russel', 'Foodigm', 2, 9, e, 10, e))) (1, 0) >>> print(visit_length(('Natalya', 'Foodigm', 2, 9, 30, 9, 45))) (e, 15) >>> print(visit_length(('Chihiro', 'Foodigm', 2, 8, 45, 9, 15))) (в, з0) >>> print(visit_length(('Aravinda', 'Afforage', 2, 9, e, 10, 0))) (1, e) >>> print(visit_length(('Chihiro', 'Foodigm', 2, 8, 30, 9, e))) (0, зе) >>> print(visit_length(('Natalya', 'Afforage', 2, 15, 10, 14, 45))) * the length of the visit is negative None >>> print(visit_length(('Aravinda', 'Nutrity', 2, 15, 10, 15, 10))) # the length of the visit is zero None
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY