Mini-Max Sum

  • + 0 comments

    when I run this code it will pass correctly , during submition this code shows wrong ouput. But I run that input by custom input ( input should be the input what when i get wrong output) it shows correct output.

    !/bin/python3

    import math import os import random import re import sys

    #

    Complete the 'miniMaxSum' function below.

    #

    The function accepts INTEGER_ARRAY arr as parameter.

    #

    def miniMaxSum(arr): # Write your code here sum = 0 min = arr[0] max = 0 for i in arr: sum += i if i < min: min = i max = min else: min = min max = i min_value = sum - max max_value = sum - min print(min_value ,end=' ') print(max_value)

    if name == 'main':

    arr = list(map(int, input().rstrip().split()))
    
    miniMaxSum(arr)