我写这段代码:
a=5
b=4
s=a*b
print(s)
20
然后我将变量“ a”更改为6:
a=6
print(s)
20
I changed variable "a" and when i say print(a)
it shows new variable(6) but when I say print(s)
it shows the same number(20)
I wonder why this happens. I expected it shows me s=24 but why it shows 20 again?
您必须再次计算s才能更改s。
After you changed
a=6
you have to computes=a*b
again to take in account the new value ofa
.