Thursday 24 May 2018

Find the second largest number in a list using python

n = int(raw_input())
arr = map(int, raw_input().split())
print set(arr).sort()[-2]

No comments:

Post a Comment

list operations in python

How to make each term of an array repeat, with the same terms grouped together? i/p: [A,B,C] o/p: [A,A,A,B,B,B,C,C,C] Solution: >...