Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python3 please thank you Question 1a - Increasing Numbers in List - First Occurence(3 points) Write a function numIncreasing1(L) that takes as input a list
python3 please thank you
Question 1a - Increasing Numbers in List - First Occurence(3 points) Write a function numIncreasing1(L) that takes as input a list of numbers and returns a list of the first sequence within that is increasing order, and has a length of at least 2. If no increasing sequential numbers are found, (ie. the input list is in descending order) then naturally a list of just the first value is returned. Increasing sequence means for a number to be valid it has to be greater than the previous [5, 2, 1, 3, 4] returns [1, 3, 4], because only the last 3 are in increasing order [-1, 1, 4, 2, 6] returns [-1, 1, 4] [5, 1, 8, 9, 10, 100] returns [1, 8, 9, 10, 100] [4, 1, 2, 3, 4, 2, 4, 6, 8] returns [1, 2, 3, 4] Hint: the break keyword may prove useful to exit a loop In [ ]: def num Increasing1(L): # Your code here! return In [ ]: print("Are my sample test cases correct?") print(numIncreasing1([5, 2, 1, 3, 4]) == [1,3,4]) print(numIncreasing1([2, 1, 4, 5, 6]) == (1,4,5,6]) print(numIncreasing1([1,2,3,4,4,3,4,5,6,7,7]) == (1,2,3,4])Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started