aidd

导航

 

博客随笔皆为学习笔记,有诸多不足,如有错误,请帮我指出,不胜感激,我后续会补全校正

一、链式赋值

a = 10
b = 10
c = 10
d = 10
print(f'a:{a}, b:{b}, c:{c}, d:{d}')
a = b = c = d = 10
print(f'a:{a}, b:{b}, c:{c}, d:{d}')

二、交叉赋值

x = 100
y = 200

temp = x
x = y
y = temp
print(f'x:{x}')
print(f'y:{y}')
x, y = y, x
print(f'x:{x}')
print(f'y:{y}')
posted on 2023-05-24 21:01  开源共享  阅读(49)  评论(0编辑  收藏  举报