Double until it passes 100 · 翻倍直到超过 100
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 · Python 基础 · While loops · while 循环 →
English
Double until it passes 100
n starts at 1. Keep doubling it while it is 100 or less. Store the first value over 100 in n.
Here the value being tested is the value being changed, so the loop needs no separate counter. It stops the moment the question turns false — and n keeps the value that made it false.
中文
翻倍直到超过 100
n 从 1 开始。只要它小于或等于 100 就不断翻倍。把第一个超过 100 的值留在 n 里。
这里被判断的值就是被改变的值,所以循环不需要另外的计数器。问题一变成“否”它就停下 —— n 里留着的就是让它变“否”的那个值。
n starts at 1. Keep doubling it while it is 100 or less. Store the first value over 100 in · 入 n. · n 从 1 开始。只要它小于或等于 100 就不断翻倍。把第一个超过 100 的值留在 n 里。
Click Run to see the output here. · 点击“运行”查看此处输出。