0

Valley numbers

A list of integers is said to be a valley if it consists of a sequence of strictly decreasing values followed by a sequence of strictly increasing values. The decreasing and increasing sequences must be of length at least 2. The last value of the decreasing sequence is the first value of the increasing sequence. Write a Python function valley(l) that takes a list of integers and returns True if l is a valley and False otherwise. ******************************************************************************************** Here are some examples to show how your function should work. >>> valley([3,2,1,2,3]) True >>> valley([3,2,1]) False >>> valley([3,3,2,1,2]) False

16th Aug 2017, 1:50 PM
Saurabh Londhe
Saurabh Londhe - avatar
4 odpowiedzi
+ 5
It's the reverse of mountain peak sequence, right? https://code.sololearn.com/W4XnnoB3gk7E/?ref=app
16th Aug 2017, 3:47 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 3
https://code.sololearn.com/cElE5XPYRK1y/?ref=app
25th Nov 2017, 5:31 PM
Daniel
Daniel - avatar
0
Answer
6th Apr 2023, 3:23 AM
12-EE-2020 HÅQ ÑÂWĂŻ.ĆH
12-EE-2020 HÅQ ÑÂWĂŻ.ĆH - avatar
0
sequence of strictly increasing values. The decreasing and increasing sequences must be of length at least 2. The last value of the decreasing sequence is the first value of the increasing sequence.Write a Python function valley(l) that takes a list of integers and returns True if l is a valley and False otherwise. Here are some examples to show how your function should work. >>> valley([3,3,2,1,2]) False 4
6th Apr 2023, 3:25 AM
12-EE-2020 HÅQ ÑÂWĂŻ.ĆH
12-EE-2020 HÅQ ÑÂWĂŻ.ĆH - avatar