FizzBuzz
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 →
FizzBuzz
The classic. Walk the numbers 1 to n and, for each, decide what string to add to a list:
- divisible by both 3 and 5 →
FizzBuzz - divisible by 3 →
Fizz - divisible by 5 →
Buzz - otherwise → the number itself, as a string
Check the "both" case first, or a multiple of 15 will be caught by the 3 test alone.
Write fizzbuzz(n) returning a list for the numbers 1..n: Fizz if divisible by 3, Buzz if by 5, FizzBuzz if by both, otherwise the number as a string. · fizzbuzz(n)를 작성하여 숫자 1..n에 대한列表를 반환하십시오: 3의 배수이면 Fizz, 5의 배수이면 Buzz, 양쪽 모두면 FizzBuzz, 아니면 숫자를 문자열로.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.