Make a function to count the longest consecutive numbers in list. for example, if the list1
Fantastic news! We've Found the answer you've been seeking!
Question:
for example, if the list1 is [1, 3, 4, 5, 6]
the longest consecutive numbers are [4, 5, 6]
and the length of the numbers is 3
so the answers should be 3
the numbers in the list1 can increase or decrease.
The format should be like
def longest_run(list1)
...(statement)
...
...
return largest_length
if there is no consecutive number, it should return '1'
Related Book For
Business Analytics Methods Models and Decisions
ISBN: 978-0321997821
2nd edition
Authors: James R. Evans
Posted Date: