小编Mau*_*ata的帖子

定义一个依赖于另一个的变量

我想要的是这个:

>>> x = 2
>>> y = x+10 
>>> print(y)
12

>>> x = 30
>>> print(y)   #Whatever x is,  y is that number x, plus 10.
40
Run Code Online (Sandbox Code Playgroud)

如何在 Python 版本 x 中声明这种“因变量”?

python python-3.x

1
推荐指数
1
解决办法
3445
查看次数

标签 统计

python ×1

python-3.x ×1