任务一 leetcode383
代码:
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
dist1={}
for i in range(26):
dist1[chr(ord('a')+i)] = 0
for i in magazine:
dist1[i]+=1
for i in ransomNote:
dist1[i]-=1
for i in dist1.keys():
if dist1[i]<0:
return False
return True
运行截图:
任务2 python debugger使用
运行作业中文件,发现报错位置位于res变量赋值完成后代码res_json = json.loads(res)的执行过程中。
此时res的值为: