识别优质注释
我们已经学习了"优质"注释应具备的特征。本练习中,您将运用这些知识,找出一个遵循注释最佳实践的函数。
本练习是课程的一部分
Python 中的软件工程原理
练习说明
print预先加载到您环境中的变量text。- 对
text调用注释更有用的那个函数,并将结果print出来。
交互式实操练习
通过完成这段示例代码来试试这个练习。
import re
def extract_0(text):
# match and extract dollar amounts from the text
return re.findall(r'\$\d+\.\d\d', text)
def extract_1(text):
# return all matches to regex pattern
return re.findall(r'\$\d+\.\d\d', text)
# Print the text
____
# Print the results of the function with better commenting
print(____)