Lecture Notes on 21 Jan 2022 * Characteristics of good software design - correct - efficient: time & space - maintainable - elegant - secure - user friendly * Writing test cases def test_cases(): # test the function longest_subsequence() assert longest_subsequence ("", "") == [] assert longest_subsequence ("abcd", "abcd") == ["abcd"] assert longest_subsequence ("abcd", "bcef") == ["bc"] assert longest_subsequence ("abcd", "xyz") == [] # other test cases return "all test cases passed" * Write a function that gets all substrings of a string # Input: s a string # Output: returns a list of all substrings of s def all_substr (s): # create a list to store all substrings substrs = [] # get size of window wnd = len (s) # get all substrings while (wnd > 0): start_idx = 0 while ((start_idx + wnd) <= len(s)): sub_string = s[start_idx: start_idx + wnd] substrs.append (sub_string) start_idx += 1 # decrease the window size wnd = wnd - 1 # return the result return substrs