Count a value
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
This one builds on a lesson you haven't finished yet. Do that lesson first: · 이 과제는 아직 완료하지 않은 수업에 기반합니다. 먼저 해당 수업을 완료하세요:
Python Basics · Functions →
English
Count a value
Count how often one value appears in a list.
Loop over the list and compare each item with target. It is the counter pattern again, with the condition item == target, and it works for words as well as numbers.
한국어
특정 값 세기
리스트에서 한 값이 얼마나 자주 나타나는지 세십시오.
리스트를 순회하며 각 항목을 target과 비교하십시오. 이는 조건 item == target이 있는 카운터 패턴이며, 숫자뿐만 아니라 문자열에도 적용됩니다.
Write count_value(items, target) that returns how many times target appears in items, without using .count().
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.