Python日常技巧2

  • Post author:
  • Post category:python




reverse翻转数组

a = [1,0,5,4,8,9]

for i in range(0,(len(a)-1)//2):
    temp = a[i]
    a[i] = a[len(a)-i-1]
    a[len(a)-i-1] = temp
print(a)



版权声明:本文为qq_43012693原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。