PYTHON  The data is given as a list of integer with comma separated in the order  ,  (i.e. [ ,,...., ,] ). This data represents the weight of the load at the given time.  For example: l = [0, 12, 5, 60, 10, 80, 13, 35] where 0 (l[0]), 5 (l[2]), 10 ([l[4]), 13 (l[6]) are (time values) and 12 (l[1]), 60 (l[3]), 80 (l[5]), 35 (l[7]) are (weight load) The data must follow specific format: 1. The time values must be defined incrementally  2. No duplicate time values  Write a function in python that checks the data to determine if the data follows the required format. If the data follows the requirements above, return True. Otherwise, return False. Example of accepted data -> return True [0, 12, 5, 60, 10, 80, 13, 35] [0, 200, 15, 120, 25, 977, 100, 3083] Example of unacceptable data -> must return False  [1, 10, 25, 50, 75, 55, 4, 100, 5, 150]: time values are not defined incrementally!  [0, 12, 5, 60, 5, 60, 13, 35]: duplicate time values! [0, 200, 15, 120, 25, 977, 15, 3083, 15, 3089]: duplicate time values!

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...
icon
Related questions
Question

PYTHON 

The data is given as a list of integer with comma separated in the order 

<hours> ,<weight> 

(i.e. [<hours> ,<weight>,...., <hours> ,<weight>] ). This data represents the weight of the load at the given time. 

For example:

l = [0, 12, 5, 60, 10, 80, 13, 35]

where 0 (l[0]), 5 (l[2]), 10 ([l[4]), 13 (l[6]) are <hours> (time values)

and 12 (l[1]), 60 (l[3]), 80 (l[5]), 35 (l[7]) are <weight> (weight load)

The data must follow specific format:

1. The time values <hours> must be defined incrementally 

2. No duplicate time values 

Write a function in python that checks the data to determine if the data follows the required format. If the data follows the requirements above, return True. Otherwise, return False.

Example of accepted data -> return True

[0, 12, 5, 60, 10, 80, 13, 35]

[0, 200, 15, 120, 25, 977, 100, 3083]

Example of unacceptable data -> must return False 

[1, 10, 25, 50, 75, 55, 4, 100, 5, 150]: time values are not defined incrementally! 

[0, 12, 5, 60, 5, 60, 13, 35]: duplicate time values!

[0, 200, 15, 120, 25, 977, 15, 3083, 15, 3089]: duplicate time values!

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY