Python: Symmetric array

# coding: utf-8 
"" "  
How to judge whether an array is a symmetric array: Requirement: judge whether the elements of the array are symmetrical. 
For example, [1, 2, 0, 2, 1], [1,2, 3, 3, 2, 1 ] Such are all symmetrical arrays. 
Use Python code to determine whether symmetrical arrays print True, not False, such as: 
x = [1, "a", 0, "2", 0, "a", 1] "" " 


x = [1, " a " , 0, " 2 " , 0, " a " , 1 ] 

if x == x [::-1 ]:
     print (True)
 else :
     print (False)

 

Guess you like

Origin www.cnblogs.com/JodieRao/p/12723590.html