在线名词解释大全 - Python程序设计 - 详细

26 Whatisydisplayedinthefollowingcode?()x = 1y = x = x + 1print("y is", y)

A
y is 0.
B
y is 1 because x is assigned to y first.
C
y is 2 because x + 1 is assigned to x and then x is assigned to y.
D
The program has a compile error since x is redeclared in the statement int y = x = x + 1.
正确答案:
相关推荐
扫描二维码
关注公众平台