+ 4

So my question is Let a=[1,0,1,0,1] so why if i use a==a.reverse() in in condition it does not satisfy

if(a==a.reverse()): print(True) else: print(False) why output is false

25th Oct 2019, 7:59 PM
Kanuj Chitranshu
Kanuj Chitranshu - avatar
2 odpowiedzi
+ 8
This is because the reverse() fonction does not return anything. You should use for this a[::-1] as it is in the code below 👍 https://code.sololearn.com/cgb6oo9EaJ2L/?ref=app
25th Oct 2019, 8:26 PM
~kyros~
~kyros~ - avatar
+ 2
Thnx
27th Oct 2019, 5:51 AM
Kanuj Chitranshu
Kanuj Chitranshu - avatar