좋은 주석 찾기
우리는 '좋은' 주석의 특징에 대해 배웠어요. 이 연습 문제에서는 그 지식을 활용해, 주석 모범 사례를 적용한 함수를 찾아보겠습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 소프트웨어 공학 원칙
연습 안내
- 환경에 미리 로드된 변수
text를print하세요. - 더 유용한 주석이 달린 함수를
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(____)