Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY