Star triangle · 星星三角形
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 基础 · Counting loops · 计数循环 →
English
Star triangle
Print a triangle of stars four rows high: one star, then two, then three, then four.
Multiplying a string repeats it: "ab" * 3 is "ababab". Let the loop variable say how many stars each row needs.
中文
星星三角形
打印一个四行高的星星三角形:第一行一颗星,然后两颗、三颗、四颗。
字符串乘以一个数会重复它:"ab" * 3 是 "ababab"。让循环变量决定每一行需要几颗星。
Print a triangle of stars with 4 rows: *, **, ***, ****. Use a loop and "*" * n. · 打印一个 4 行的星星三角形:*、**、***、****。用循环和 "*" * n。
Click Run to see the output here. · 点击“运行”查看此处输出。