简体   繁体   English

符号“?”是什么意思? 在蟒蛇?

[英]What is meaning of symbol "!" in python?

In my code that I was working on, my teacher used symbol.?在我正在编写的代码中,我的老师使用了符号。? Can anyone tell what is meaning of symbol !谁能说出符号的含义! in this code?在这段代码中?

n! = (n-1)! * n
sum(n) = sum(n-1) + n

If you actually ran the code you would have seen there is a syntax error:如果您实际运行代码,您会看到存在语法错误:

>>> n = 1
>>> n! = (n-1)! * n
  File "<stdin>", line 1
    n! = (n-1)! * n
     ^
SyntaxError: invalid syntax

You cannot have a !你不能有一个! in a variable name.在变量名中。

This snippet is most probably pseudo-code with factorials for practicing recursion or something like that.这个片段很可能是带有阶乘的伪代码,用于练习递归或类似的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM