print( stop_ascending([]) ) # None
print( stop_ascending([1, 2, 3]) ) # 3
print( stop_ascending([1, 2, 3, 1, 5]) ) # 3
Module 7 Assignments
Short Project 06
Due date: Oct 15, Tuesday at 7pm
Short Programming projects are submitted during our weekly 45-minute in-person lab sessions. Each lab sessions is guided by two TAs. The instructions for the short project will be available only during the lab sessions. To schedule your lab session go to the weekly lab session spreadsheet.
Programming Problems
Programming Problems should be submitted to gradescope.
Programming Problem 13
Due date: Oct 15, Tuesday at 7pm
Write a Python function that does the following:
1. Its name is stop_ascending
.
2. It takes a list of numbers as argument.
3. It returns the index of the first value that is not larger than the preceding value.
4. If the list is entirely ascending, then the function should return the length of the list.
5. Be very careful to return the correct index.
Name the program ascending.py
. Make sure that gradescope gives you the points for passing the test case.
Test cases:
Programming Problem 14
Due date: Oct 15, Tuesday at 7pm
Write a Python function that does the following:
- Its name is
combine
. - It takes two lists as parameter.
- It combines the two lists into a single list that contains exactly the same values – make sure you add the items from the second list into the first list (the first list needs to be modified)
- Do not use any list methods besides
.append
.
Name the program combine_lists.py
. Make sure that gradescope gives you the points for passing the test case.
Test cases:
= []
test_list
combine(test_list, []) print(test_list) # []
= [1, 2, 3]
test_list 1, 1])
combine(test_list, [print(test_list) # [1, 2, 3, 1, 1]
= [1, 2, 3, 1, 5]
test_list
combine(test_list, [])print(test_list) # [1, 2, 3, 1, 5]