Ask for a name · 询问名字
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 基础 · Getting input · 获取输入 →
English
Ask for a name
input() reads one line that the user types. Store it in a box, then use it.
When you press Run, the program waits: a highlighted box appears under the code. Type a name there and press Enter. Check answer types Sam for you.
中文
询问名字
input() 读取用户输入的一行。把它存进盒子,然后使用它。
按运行后,程序会等你:代码下面会出现一个高亮的方框。在那里输入一个名字,再按回车键。按检查答案时,会替你输入 Sam。
Read a name with input(). Then show Hi, + the name + !. For Sam, show Hi, Sam!. · 用 input() 读取一个名字。然后显示 Hi, + 名字 + !。输入 Sam 时,显示 Hi, Sam!。
Click Run to see the output here. · 点击“运行”查看此处输出。