Skip to content

Learn to code · ⁨学习编程⁩

Code · ⁨代码⁩

Write real code and see it run — HTML, CSS, Python, Java, C, SQL, LaTeX, and Linux — with nothing to install. · ⁨编写真实代码并运行——HTML、CSS、Python、Java、C、SQL、LaTeX 和 Linux——无需安装任何软件。⁩

17 courses · ⁨17 门课程⁩HTML/CSS · Python · Java · C · SQL · LaTeX · LinuxRuns in your browser · ⁨在浏览器中运行⁩
Foundations · ⁨基础⁩
Python Basics · ⁨Python 基础⁩
Your very first steps in programming — no experience needed. · ⁨编程的第一步 —— 无需任何基础。⁩
22 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
JavaScript
The language of the web. Make things happen — runs right in your browser. · ⁨网页的语言。让程序动起来 —— 直接在你的浏览器里运行。⁩
15 Lessons · ⁨课程⁩
C Programming · ⁨C 语言编程⁩
From printf to pointers, memory, and data structures — compile and run in your browser. · ⁨从 printf 到指针、内存与数据结构 —— 在浏览器中编译并运行。⁩
23 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
A short history of C · ⁨C 语言简史⁩
What C is used for · ⁨C 语言用来做什么⁩
Where to learn more · ⁨更多学习资源⁩
Set up your computer · ⁨设置你的电脑⁩
C basics: main, printf, and functions · ⁨C 基础:main、printf 与函数⁩
Variables, types, and arithmetic · ⁨变量、类型与算术⁩
Booleans and selection: if, else, switch · ⁨布尔与选择:if、else、switch⁩
Loops: while, for, and accumulation · ⁨循环:while、for 与累加⁩
Functions, parameters, and return values · ⁨函数、参数与返回值⁩
Nested loops and patterns · ⁨嵌套循环与图案⁩
1-D arrays: store, index, and traverse · ⁨一维数组:存储、索引与遍历⁩
Pointers: &, *, and pass-by-pointer · ⁨指针:&、* 与按指针传参⁩
Strings: char arrays and the null terminator · ⁨字符串:字符数组与结束符⁩
Array algorithms: max, count, search, average · ⁨数组算法:最大值、计数、查找、平均⁩
2-D arrays: working with a grid · ⁨二维数组:处理网格⁩
Searching: linear and binary · ⁨查找:线性与二分⁩
Sorting: bubble, selection, and insertion · ⁨排序:冒泡、选择与插入⁩
Recursion: base case and recursive case · ⁨递归:终止条件与递归情形⁩
Structs and typedef: . vs -> · ⁨结构体与 typedef:. 与 ->⁩
Dynamic memory: malloc, free, and realloc · ⁨动态内存:malloc、free 与 realloc⁩
Linked lists · ⁨链表⁩
Stacks and queues (array-backed) · ⁨栈与队列(用数组实现)⁩
Text files: write then read · ⁨文本文件:先写后读⁩
Error handling with return codes · ⁨用返回码处理错误⁩
Bits, binary, and bitwise operators · ⁨位、二进制与按位运算⁩
Run-length encoding (compression) · ⁨行程长度编码(压缩)⁩
Preprocessor, const, static, and enum · ⁨预处理器、const、static 与 enum⁩
Web Basics — HTML & CSS · ⁨网页基础 —— HTML 与 CSS⁩
Start from zero. Short steps. Build a real web page. · ⁨从零开始,一步一步,做出真正的网页。⁩
21 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
Exam courses · ⁨考试课程⁩
Python for IGCSE CS · ⁨IGCSE 计算机科学 Python⁩
Programming, algorithms, databases and logic for Cambridge IGCSE 0478. · ⁨面向剑桥 IGCSE 0478 的编程、算法、数据库与逻辑。⁩
14 Lessons · ⁨课程⁩
IGCSE CS Pseudocode · ⁨IGCSE 计算机科学伪代码⁩
Write and run the pseudocode in the Cambridge IGCSE 0478 syllabus for 2026, 2027 and 2028. · ⁨编写并运行剑桥 IGCSE 0478 2026、2027 与 2028 考纲中的伪代码。⁩
19 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
Python for A-Level CS · ⁨A-Level 计算机科学 Python⁩
Data structures, algorithms, and OOP for Cambridge 9618. · ⁨面向剑桥 9618 的数据结构、算法与面向对象编程。⁩
15 Lessons · ⁨课程⁩
AS-level CS Pseudocode · ⁨AS 计算机科学伪代码⁩
Write and run the pseudocode in the Cambridge 9618 guide for exams in 2026, and for 2027, 2028 and 2029. · ⁨编写并运行剑桥 9618 指南中的伪代码,用于 2026 年考试,以及 2027、2028 与 2029 年考试。⁩
19 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
Python for AP CS Principles · ⁨AP 计算机科学原理 Python⁩
Big ideas of computing — data, algorithms, the Internet, and impact. · ⁨计算机科学的核心思想 —— 数据、算法、互联网与影响。⁩
15 Lessons · ⁨课程⁩
Java for AP CS A · ⁨AP 计算机科学 A Java⁩
Java programming for the AP Computer Science A exam. · ⁨面向 AP 计算机科学 A 考试的 Java 编程。⁩
19 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
A short history of Java · ⁨Java 简史⁩
What Java is used for · ⁨Java 用来做什么⁩
Where to learn more · ⁨更多学习资源⁩
Set up your computer · ⁨设置你的电脑⁩
Java basics: classes, main, and output · ⁨Java 基础:类、main 和输出⁩
Using objects: String, Math, and wrappers · ⁨使用对象:String、Math 和包装类⁩
Booleans and selection: if/else and logic · ⁨布尔值与选择:if/else 和逻辑⁩
Loops: while, for, and accumulation · ⁨循环:while、for 和累加⁩
Strings and nested loops · ⁨字符串与嵌套循环⁩
Writing a class: fields, constructor, methods · ⁨编写类:字段、构造方法和方法⁩
Encapsulation: private fields, getters, setters · ⁨封装:私有字段、getter 和 setter⁩
1-D arrays: store, index, and traverse · ⁨一维数组:存储、下标和遍历⁩
Array algorithms: max, count, search, average · ⁨数组算法:最大值、计数、查找、平均值⁩
ArrayList: a list that grows · ⁨ArrayList:可以增长的列表⁩
ArrayList algorithms: filter and the remove bug · ⁨ArrayList 算法:筛选与删除的 bug⁩
2-D arrays: working with a grid · ⁨二维数组:操作网格⁩
Searching: linear and binary · ⁨查找:线性查找与二分查找⁩
Sorting: selection and insertion sort · ⁨排序:选择排序与插入排序⁩
Recursion: base case and recursive case · ⁨递归:基本情形与递归情形⁩
Text files: write and read with Scanner · ⁨文本文件:用 Scanner 写和读⁩
Inheritance: extends, super, and overriding · ⁨继承:extends、super 与重写⁩
Polymorphism: dynamic dispatch and toString() · ⁨多态:动态分派与 toString()⁩
FRQ workshop: the 4 question types · ⁨自由作答攻略:四种题型⁩
Topics & tools · ⁨主题与工具⁩
Databases & SQL · ⁨数据库与 SQL⁩
Query, design, and change relational databases — right in your browser, no setup. · ⁨查询、设计并修改关系数据库 —— 直接在浏览器中完成,无需安装。⁩
17 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
Linux & the command line · ⁨Linux 与命令行⁩
Drive a computer by typing. Practise real shell commands in a safe in-browser terminal. · ⁨用键盘驾驭计算机。在安全的浏览器终端里练习真正的 shell 命令。⁩
14 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
LaTeX
Typeset beautiful documents and maths — write LaTeX, compile on our servers, see the PDF. · ⁨排版精美的文档与数学公式 —— 编写 LaTeX,在我们的服务器上编译,直接查看 PDF。⁩
14 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →
Cyber security · ⁨网络安全⁩
How attacks work and how to stop them — ciphers, hashing, and safe computing, hands-on. · ⁨攻击如何发生,又如何防御 —— 动手学习密码、哈希与安全计算。⁩
16 Lessons · ⁨课程⁩
Course overview and progress · ⁨课程概览与进度⁩ →

Practice · ⁨练习⁩

Sharpen your skills with challenges from 1★ to 5★. Pick a language. · ⁨通过 1★ 至 5★ 挑战提升技能。选择一种语言。⁩

01
Print a word · ⁨打印一个单词⁩
★☆☆☆☆
02
Print another word · ⁨再打印一个单词⁩
★☆☆☆☆
03
Print a sentence · ⁨打印一句话⁩
★☆☆☆☆
04
Print with a ! · ⁨用感叹号打印⁩
★☆☆☆☆
05
Print two lines · ⁨打印两行⁩
★☆☆☆☆
06
Print three lines · ⁨打印三行⁩
★☆☆☆☆
07
Print a number · ⁨打印一个数字⁩
★☆☆☆☆
08
Print a bigger number · ⁨打印一个更大的数字⁩
★☆☆☆☆
09
Add two numbers · ⁨两数相加⁩
★☆☆☆☆
10
Add bigger numbers · ⁨更大的数相加⁩
★☆☆☆☆
11
Subtract · ⁨减法⁩
★☆☆☆☆
12
Multiply · ⁨乘法⁩
★☆☆☆☆
13
Divide · ⁨除法⁩
★☆☆☆☆
14
Remainder · ⁨求余数⁩
★☆☆☆☆
15
Use a variable · ⁨使用变量⁩
★☆☆☆☆
16
A number variable · ⁨数字变量⁩
★☆☆☆☆
17
Change a variable · ⁨改变变量⁩
★☆☆☆☆
18
Add two variables · ⁨变量相加⁩
★☆☆☆☆
19
Multiply two variables · ⁨变量相乘⁩
★☆☆☆☆
20
Join two words · ⁨连接两个单词⁩
★☆☆☆☆
21
Greet a name · ⁨问候名字⁩
★☆☆☆☆
22
Repeat text · ⁨重复文字⁩
★☆☆☆☆
23
Ask for a name · ⁨询问名字⁩
★☆☆☆☆
24
Echo a number · ⁨回显数字⁩
★☆☆☆☆
105
Call a function · ⁨调用一个函数⁩
★☆☆☆☆
106
Use what it gives back · ⁨使用它返回的值⁩
★☆☆☆☆
107
Finish the function · ⁨把函数补完⁩
★☆☆☆☆
108
Write one yourself · ⁨自己写一个⁩
★★☆☆☆
25
Your first function · ⁨你的第一个函数⁩
★☆☆☆☆
26
Is it positive? · ⁨是正数吗?⁩
★☆☆☆☆
27
The bigger one · ⁨较大的那个⁩
★☆☆☆☆
28
The last item · ⁨最后一项⁩
★☆☆☆☆
29
Is it even? · ⁨是偶数吗?⁩
★☆☆☆☆
30
Sum a list · ⁨求列表之和⁩
★☆☆☆☆
31
Reverse a string · ⁨反转字符串⁩
★★☆☆☆
32
Count the vowels · ⁨数元音字母⁩
★★☆☆☆
33
FizzBuzz
★★★☆☆
34
Letter frequencies · ⁨字母频率⁩
★★★☆☆
35
Remove duplicates · ⁨去除重复项⁩
★★★☆☆
36
Second largest · ⁨第二大的值⁩
★★★☆☆
37
Group anagrams · ⁨变位词分组⁩
★★★★☆
38
Flatten a nested list · ⁨展平嵌套列表⁩
★★★★☆
39
RPN calculator · ⁨逆波兰计算器⁩
★★★★★
40
Run-length encoding · ⁨游程编码⁩
★★★★★
41
Count to ten · ⁨数到十⁩
★★☆☆☆
42
Even numbers · ⁨偶数⁩
★★☆☆☆
43
Liftoff · ⁨发射⁩
★★☆☆☆
44
Star triangle · ⁨星星三角形⁩
★★☆☆☆
45
The 3 times table · ⁨3 的乘法表⁩
★★☆☆☆
46
Running total · ⁨累计求和⁩
★★★☆☆
47
Largest without max · ⁨不用 max 找最大值⁩
★★★☆☆
48
Smallest without min · ⁨不用 min 找最小值⁩
★★★☆☆
49
Count the positives · ⁨数一数正数⁩
★★☆☆☆
50
Average of a list · ⁨列表的平均数⁩
★★★☆☆
51
Add up 1 to 100 · ⁨从 1 加到 100⁩
★★☆☆☆
52
Upside-down triangle · ⁨倒三角形⁩
★★☆☆☆
53
FizzBuzz with 4 and 6 · ⁨4 和 6 的 FizzBuzz⁩
★★★☆☆
54
Until you type stop · ⁨直到输入 stop⁩
★★★☆☆
55
A list of squares · ⁨平方数列表⁩
★★☆☆☆
56
Count a value · ⁨统计某个值⁩
★★☆☆☆
57
Keep the evens · ⁨只留下偶数⁩
★★☆☆☆
58
Find the position · ⁨找到位置⁩
★★★☆☆
59
Smallest and largest · ⁨最小值和最大值⁩
★★★☆☆
60
Above average · ⁨高于平均数⁩
★★★☆☆
61
Binary to denary · ⁨二进制转十进制⁩
★★★★☆
62
Denary to binary · ⁨十进制转二进制⁩
★★★★☆
63
Digital root · ⁨数字根⁩
★★★★☆
64
Caesar cipher · ⁨凯撒密码⁩
★★★★☆
65
Bank account · ⁨银行账户⁩
★★★★☆
66
Transpose a grid · ⁨网格转置⁩
★★★★☆
67
Most common word · ⁨出现最多的单词⁩
★★★★★
68
Sieve of Eratosthenes · ⁨埃拉托色尼筛法⁩
★★★★★
69
A row of Pascal's triangle · ⁨杨辉三角的一行⁩
★★★★★
70
Tic-tac-toe winner · ⁨井字棋赢家⁩
★★★★★
71
Is it big? · ⁨够大吗?⁩
★☆☆☆☆
72
Pass or fail · ⁨及格还是不及格⁩
★☆☆☆☆
73
Positive, negative or zero · ⁨正数、负数还是零⁩
★☆☆☆☆
74
The bigger number · ⁨较大的那个数⁩
★☆☆☆☆
75
Even or odd · ⁨奇数还是偶数⁩
★☆☆☆☆
76
Is it in range? · ⁨在范围内吗?⁩
★★☆☆☆
77
Free entry · ⁨免费入场⁩
★★☆☆☆
78
Grade letter · ⁨等第字母⁩
★★☆☆☆
79
Divisible by both · ⁨能同时整除⁩
★★☆☆☆
80
Ticket price · ⁨票价⁩
★★☆☆☆
81
Finish the countdown · ⁨把倒数补完⁩
★☆☆☆☆
82
The loop that never ends · ⁨停不下来的循环⁩
★☆☆☆☆
83
Count up to five · ⁨数到五⁩
★☆☆☆☆
84
Add up to five · ⁨加到五⁩
★☆☆☆☆
85
Double until it passes 100 · ⁨翻倍直到超过 100⁩
★★☆☆☆
86
Stop at the first over fifty · ⁨在第一个超过五十处停下⁩
★★☆☆☆
87
Count down in twos · ⁨每次减二倒数⁩
★★☆☆☆
88
Until they type stop · ⁨直到输入 stop⁩
★★☆☆☆
89
How many halvings? · ⁨要减半几次?⁩
★★☆☆☆
90
A row of the times table · ⁨乘法表的一行⁩
★★☆☆☆
91
The first letter · ⁨第一个字母⁩
★☆☆☆☆
92
The last letter · ⁨最后一个字母⁩
★☆☆☆☆
93
The first three letters · ⁨前三个字母⁩
★☆☆☆☆
94
How long is it? · ⁨它有多长?⁩
★☆☆☆☆
95
Shout it · ⁨大声说⁩
★☆☆☆☆
96
Initials · ⁨姓名首字母⁩
★★☆☆☆
97
Ask for a name · ⁨问一个名字⁩
★☆☆☆☆
98
Ask for two things · ⁨问两样东西⁩
★☆☆☆☆
99
A number from input · ⁨读入一个数⁩
★☆☆☆☆
100
Add two numbers you were given · ⁨把读入的两个数相加⁩
★★☆☆☆
101
Each letter on its own line · ⁨每个字母一行⁩
★☆☆☆☆
102
Zero to four · ⁨从零到四⁩
★☆☆☆☆
103
Count the letters · ⁨数字母⁩
★☆☆☆☆
104
Add up one to five · ⁨一加到五⁩
★☆☆☆☆
01
Print a word · ⁨打印一个单词⁩
★☆☆☆☆
02
Print another word · ⁨再打印一个单词⁩
★☆☆☆☆
03
Print a sentence · ⁨打印一句话⁩
★☆☆☆☆
04
Print with a ! · ⁨用感叹号打印⁩
★☆☆☆☆
05
Print two lines · ⁨打印两行⁩
★☆☆☆☆
06
Print a number · ⁨打印一个数字⁩
★☆☆☆☆
07
Add two numbers · ⁨两数相加⁩
★☆☆☆☆
08
Subtract · ⁨减法⁩
★☆☆☆☆
09
Multiply · ⁨乘法⁩
★☆☆☆☆
10
Divide · ⁨除法⁩
★☆☆☆☆
11
Remainder · ⁨求余数⁩
★☆☆☆☆
12
A number variable · ⁨数字变量⁩
★☆☆☆☆
13
A text variable · ⁨文字变量⁩
★☆☆☆☆
14
Add two variables · ⁨变量相加⁩
★☆☆☆☆
15
Your first method · ⁨你的第一个方法⁩
★☆☆☆☆
16
Is it positive? · ⁨是正数吗?⁩
★☆☆☆☆
17
Cube a number · ⁨求立方⁩
★☆☆☆☆
18
The smaller one · ⁨较小的那个⁩
★☆☆☆☆
19
Square a number · ⁨求平方⁩
★☆☆☆☆
20
Largest of three · ⁨三者中的最大值⁩
★☆☆☆☆
21
Count the vowels · ⁨数元音字母⁩
★★☆☆☆
22
Reverse the word order · ⁨反转单词顺序⁩
★★☆☆☆
23
Palindrome check · ⁨回文判断⁩
★★★☆☆
24
Running sum · ⁨前缀和⁩
★★★☆☆
25
Most frequent character · ⁨出现最多的字符⁩
★★★☆☆
26
Binary search · ⁨二分查找⁩
★★★☆☆
27
Factorial (mind the size) · ⁨阶乘(注意大小)⁩
★★★★☆
28
Count primes below n · ⁨数小于 n 的质数⁩
★★★★☆
29
Roman numerals · ⁨罗马数字⁩
★★★★★
30
Longest common prefix · ⁨最长公共前缀⁩
★★★★★
01
Print a word · ⁨打印一个单词⁩
★☆☆☆☆
02
Print another word · ⁨再打印一个单词⁩
★☆☆☆☆
03
Print a sentence · ⁨打印一句话⁩
★☆☆☆☆
04
Print with a ! · ⁨用感叹号打印⁩
★☆☆☆☆
05
Print two lines · ⁨打印两行⁩
★☆☆☆☆
06
Print three lines · ⁨打印三行⁩
★☆☆☆☆
07
Print a number · ⁨打印一个数字⁩
★☆☆☆☆
08
Add two numbers · ⁨两数相加⁩
★☆☆☆☆
09
Subtract · ⁨减法⁩
★☆☆☆☆
10
Multiply · ⁨乘法⁩
★☆☆☆☆
11
Remainder · ⁨求余数⁩
★☆☆☆☆
12
A number variable · ⁨数字变量⁩
★☆☆☆☆
13
Add two variables · ⁨变量相加⁩
★☆☆☆☆
14
Multiply two variables · ⁨变量相乘⁩
★☆☆☆☆
15
Your first function · ⁨你的第一个函数⁩
★☆☆☆☆
16
Is it positive? · ⁨是正数吗?⁩
★☆☆☆☆
17
Cube a number · ⁨求立方⁩
★☆☆☆☆
18
The smaller one · ⁨较小的那个⁩
★☆☆☆☆
19
Square a number · ⁨求平方⁩
★☆☆☆☆
20
Sign of a number · ⁨数的符号⁩
★☆☆☆☆
21
Largest of three · ⁨三个数的最大值⁩
★★☆☆☆
22
Factorial · ⁨阶乘⁩
★★☆☆☆
23
Greatest common divisor · ⁨最大公约数⁩
★★☆☆☆
24
Count the 1-bits · ⁨数 1 的位⁩
★★☆☆☆
25
Sum an array · ⁨数组求和⁩
★★★☆☆
26
Swap two values · ⁨交换两个值⁩
★★★☆☆
27
String length · ⁨字符串长度⁩
★★★☆☆
28
Count a character · ⁨统计某个字符⁩
★★★☆☆
29
Reverse in place · ⁨原地反转⁩
★★★★☆
30
Palindrome · ⁨回文⁩
★★★★☆
31
Bubble sort · ⁨冒泡排序⁩
★★★★☆
32
Points with a struct · ⁨用结构体表示点⁩
★★★★☆
33
Binary search · ⁨二分查找⁩
★★★★★
34
Parse an integer · ⁨解析整数⁩
★★★★★
All courses, one page each · ⁨所有课程,每课一页⁩

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩