您发现的是伪代码Pseudocode is an informal high-level description of the operating

principle of a computer program or other algorithm.

:=运算符实际上是赋值运算符。在python中,这只是=运算符。

要将这个伪代码转换成Python,您需要知道被引用的数据结构,以及更多的算法实现。

关于psuedocode的一些注记

:=是python中的赋值运算符或=

=是python中的相等运算符或==

请注意,有某些类型的伪代码,您的里程数可能会有所不同:

帕斯卡式伪码procedure fizzbuzz
For i := 1 to 100 do
set print_number to true;
If i is divisible by 3 then
print "Fizz";
set print_number to false;
If i is divisible by 5 then
print "Buzz";
set print_number to false;
If print_number, print i;
print a newline;
end
C型伪码void function fizzbuzz
For (i = 1; i <= 100; i++) {
set print_number to true;
If i is divisible by 3
print "Fizz";
set print_number to false;
If i is divisible by 5
print "Buzz";
set print_number to false;
If print_number, print i;
print a newline;
}

注意大括号用法和赋值运算符的不同。