Skip to content

Introduction

PyCN is literally means Python Chinese, which uses the same syntaxes as Python. However, it's keywords, literals, built-in functions and operators is using Chinese.

Let's have a look to this example:

pycn
定义 是否是质数被判断的数
    如果 被判断的数 小于
        返回
    迭代 数一 范围整数被判断的数 取幂 零点五
        如果 被判断的数 取余 数一 等于
            返回
    返回

the code above means:

python
def is_prime(num):
    if num < 2:
        return false
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return false
    return true

That's right! PyCN has exactly the same coding style as Python, but as you can see, the PyCN code is in Chinese like I said before.

Install PyCN interpreter

To run your own PyCN code, I recommend you to downlaod the compiled PyCN interpreter:

if you are using macOS, you can get pycn from HomeBrew:

shell
brew tap vincent-the-gamer/homebrew-tap
brew install pycn

Online playground

Besides, if you just want to play PyCN for a while, I put the wasm pack to my website:

https://mayu.vince-g.xyz/code-runner

Switch language to pycn and you are ready.

Syntax Highlighting

Currently, PyCN supports syntax highlighting in VSCode.

Install Pycn extension and get highlight automatically.

highlight

Document by Vincent-the-gamer | MIT Licensed