摘要: OOP Q1: Vending Machine In this question you'll create a vending machine that only outputs a single product and provides change when needed. Create a 阅读全文
posted @ 2022-02-27 15:54 MartinLwx 阅读(1436) 评论(0) 推荐(0) 编辑
摘要: Q2: Over or Under Define a procedure over-or-under which takes in a number num1 and a number num2 and returns the following: -1 if num1 is less than n 阅读全文
posted @ 2022-02-27 12:52 MartinLwx 阅读(1158) 评论(3) 推荐(0) 编辑
摘要: Recursion and Tree Recursion Q1: Subsequences A subsequence of a sequence S is a subset of elements from S, in the same order they appear in S. Consid 阅读全文
posted @ 2022-02-26 21:56 MartinLwx 阅读(1574) 评论(0) 推荐(1) 编辑
摘要: Q2: Convert Link Write a function convert_link that takes in a linked list and returns the sequence as a Python list. You may assume that the input li 阅读全文
posted @ 2022-02-25 11:15 MartinLwx 阅读(2206) 评论(0) 推荐(0) 编辑
摘要: Accounts Q2: Retirement Add a time_to_retire method to the Account class. This method takes in an amount and returns how many years the holder would n 阅读全文
posted @ 2022-02-24 16:09 MartinLwx 阅读(720) 评论(0) 推荐(0) 编辑
摘要: Q1: Generate Permutations Given a sequence of unique elements, a permutation of the sequence is a list containing the elements of the sequence in some 阅读全文
posted @ 2022-02-24 00:00 MartinLwx 阅读(3192) 评论(0) 推荐(0) 编辑
摘要: Mutability Write a function which takes in a list lst, an argument entry, and another argument elem. This function will check through each item in lst 阅读全文
posted @ 2022-02-21 00:35 MartinLwx 阅读(1484) 评论(0) 推荐(0) 编辑
摘要: Mobiles Q2: Weights Implement the planet data abstraction by completing the planet constructor and the size selector so that a planet is represented u 阅读全文
posted @ 2022-02-20 15:18 MartinLwx 阅读(1890) 评论(0) 推荐(0) 编辑
摘要: Lists Q1: Factors List Write factors_list, which takes a number n and returns a list of its factors in ascending order. 我们可以知道这么一个基本的数学事实: 一个数字的因子最大仅可 阅读全文
posted @ 2022-02-19 17:11 MartinLwx 阅读(1212) 评论(0) 推荐(0) 编辑
摘要: Intro 我发现解决递归的问题真的很有意思, 我喜欢这种解决问题的方式, 代码足够简洁而且做出来很直观, 这也是我写下这篇文章的原因. 📒 如何解决好递归的问题 ? 想清楚什么是 base case ? 怎么把当前的问题分解为更简单的问题 ? 时刻要记住我们定义的函数的定义 后面我也会按照这个思 阅读全文
posted @ 2022-02-08 23:11 MartinLwx 阅读(639) 评论(0) 推荐(0) 编辑