Question: As mentioned, a run is a sequence of consecutive repeated values. Implement a Python function called longest_run that takes a list of numbers and returns

As mentioned, a run is a sequence of consecutive repeated values. Implement a Python function called longest_run that

takes a list of numbers and returns the length of the longest run. For example in the sequence: 2, 7, 4, 4, 2, 5, 2, 5, 10, 12, 5, 5,

5, 5, 6, 20, 1 the longest run has length 4. Then, in the main portion of your program should ask the user to input the list, then it

should call longest_run function, and print the result. You may assume that the user will always enter at least two elements,

but your function longest_run should work for all lists of numbers of length at least 1.

Examples of runs:

Example 1:

Please input a list of numbers separated by commas: 1,1,2,3,3,3,3,3,6,5

5

Example 2:

Please input a list of numbers separated by commas: 6,6,7,1,1,1,1,4, 1

4

Example 3:

Please input a list of numbers separated by commas: 6,2,4,8,6

1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!