先跑起来
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
从这里开始
- 每节课由一些简短的步骤组成。按继续(页面底部的箭头)进入下一步。
- 步骤之后是任务:你要修改并运行的代码。
- 今天你几乎不用打字,每次只改一个小地方。
这些按钮
- 运行 ▶ 执行代码。打印出的内容会显示在代码下面的深色方框里。
- 检查答案 测试你的代码。变成绿色就是正确,你还会赢得金币。
- 卡住的时候,按灯泡获取提示。
- 重置 把代码恢复成一开始的样子。
English
print("I am an example. Press the play button to run me.")
出错的时候
- 如果代码有错误,Python 会停下来,显示红色文字。
- 红色文字下面有一张卡片,用英文和中文解释这个错误,并告诉你该看哪一行。
- 出错很正常。读一读卡片,改一个地方,再运行一次。
程序等你输入的时候
- 有些程序会用
input()向你提问。 - 这时会出现一个高亮的方框:在这里输入,然后按回车。
- 点一下方框,输入你的回答,再按回车键,程序就会继续运行。
English
name = input("What is your name? ")
print("Nice to meet you, " + name)
现在轮到你
- 三个小任务。修改代码,按运行,再按检查答案。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
This program is switched off: the # at the start makes the line a comment, so Python skips it. Delete the #, press Run ▶ to see what it prints, then press Check answer.
点击“运行”查看此处输出。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
变化 one word so the program prints I like dogs. Only the text inside the quotes changes.
点击“运行”查看此处输出。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
This program has a mistake. Press Run ▶ first and read the card under the red text: it explains the error. Then fix the line so the program prints Hello.
点击“运行”查看此处输出。