Minimum Loss Hackerrank Solution In Python