finding the percentange hackerrank solution in python