cs61a 2021fall discussion2 problem9和problem10

网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc02/
这两道题目我在写的时候都犯了一个错误,就是容易修改parent frame的parameter,
报错一般是 local variable [var] referenced before assignment
这点一定要注意,不能修改上一层的参数
Problem9:
没有用题目给的代码框架(因为看了下面problem10里面有一句)
Important: For this problem, the starter code is a suggestion. You are welcome to add/delete/modify the starter code template, or even write your own solution that doesn’t use the starter code at all.
所以就修改框架了







下面是用了框架的:





Problem10:

posted @ 2022-03-16 00:20  天然气之子  阅读(84)  评论(0编辑  收藏  举报