[Solved]Python output problem | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

[Solved]Python output problem

What is the output of this code? a=[0,57,28] a.sort(reverse=True) print(a[2]) Can anyone explain what would be the output and why??

24th Apr 2020, 5:43 AM
Akshay Jain
Akshay Jain - avatar
2 ответов
+ 2
Here reverse=True means array will sort in reverse order means greater value should come first. So a will be = [57, 28, 0] and a[2] = 0 when reverse= False, a will be [0, 28, 57]
24th Apr 2020, 6:05 AM
A͢J
A͢J - avatar
24th Apr 2020, 11:14 AM
Akshay Jain
Akshay Jain - avatar