Skip to content

Instantly share code, notes, and snippets.

@sameerg07
Created June 4, 2021 04:39
Show Gist options
  • Save sameerg07/ca29f67126e63e5e78f83e4aabc3dbc5 to your computer and use it in GitHub Desktop.
Save sameerg07/ca29f67126e63e5e78f83e4aabc3dbc5 to your computer and use it in GitHub Desktop.
second largest number in a list
# Read the input list
import ast,sys
input_str = sys.stdin.read()
input_list = ast.literal_eval(input_str)
# Write your code here
try:
print(list(set(sorted(input_list)))[-2])
except:
print("not present")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment