首页 > 解决方案 > 2 variables = 1 other variables

问题描述

I want to know if we can simplify a code in Python:

a = 5
b = a
c = a
d = a 
...

标签: pythonpython-3.xpython-2.7

解决方案


简化示例的唯一方法是使用链式赋值。

a = b = c = d = 5

推荐阅读