How many halvings? · 얼마나 반으로 나눴는가?
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 · While loops →
English
How many halvings?
n starts at 40. Halve it with n = n // 2 until it reaches 0, counting the steps in steps.
// divides and throws the remainder away, so 5 // 2 is 2. Counting how many times a loop went round needs its own variable, going up by one each turn.
한국어
반으로 나누는 횟수?
n는 40에서 시작합니다. n = n // 2를 사용하여 반으로 나누고 0에 도달할 때까지 steps에 단계를 세합니다.
//는 나눈 후 나머지를 버리므로, 5 // 2은 2가 됩니다. 루프가 몇 번이나 도는지 세는 것은 별도의 변수가 필요하며, 매 순환마다 1씩 증가해야 합니다.
n starts at 40. Halve it with n = n // 2 until it reaches 0, counting the steps in steps. · n는 40에서 시작합니다. n = n // 2를 사용하여 반으로 나누고 0에 도달할 때까지 steps에 단계를 세합니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.