Skip to content

Instantly share code, notes, and snippets.

@inspirit941
Created March 5, 2020 04:36
Show Gist options
  • Select an option

  • Save inspirit941/289d5bea2834c015a4c8118c544148f7 to your computer and use it in GitHub Desktop.

Select an option

Save inspirit941/289d5bea2834c015a4c8118c544148f7 to your computer and use it in GitHub Desktop.
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the bigSorting function below.
def bigSorting(unsorted):
return sorted(unsorted,key=lambda x: (len(x), x))
# temp = list(map(str, temp))
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
unsorted = []
for _ in range(n):
unsorted_item = input()
unsorted.append(unsorted_item)
result = bigSorting(unsorted)
fptr.write('\n'.join(result))
fptr.write('\n')
fptr.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment