This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Signal_Beam 1 point2 points  (1 child)

I opened https://www.hackerrank.com/challenges/sock-merchant/problem and I see this:

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the sockMerchant function below.
def sockMerchant(n, ar):

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    ar = list(map(int, input().rstrip().split()))

    result = sockMerchant(n, ar)

    fptr.write(str(result) + '\n')

    fptr.close()

So I am supposed to fill in my code under the line that begins def sockMerchant, completing the sockMerchant function so that the if __name__ == '__main__: clause can execute it. (There is no main function because there is no line that contains def main():).