Friday, February 1, 2019

Three Idiots

  • Problem Description

    Create a program that reads three integers from the user and displays them in sorted order (from smallest to largest). 

    Use the min and max functions to find the smallest and largest values. 

    The middle value can be found by computing the sum of all three values, and then subtracting the minimum value and the maximum value.
  • CODING ARENA
  • a=[]
    for i in range(3):
        b=int(input())
        a.append(b)
    a.sort()
    print("The minimum value is",a[0])
    print("The maximum value is",a[2])
    print("The middle value is",a[1])
  • Test Case 1

    Input (stdin)
    25
    
    12
    
    1988
    
    
    Expected Output
    The minimum value is 12
    
    The maximum value is 1988
    
    The middle value is 25
  • Test Case 2

    Input (stdin)
    9
    
    19
    
    1972
    
    
    Expected Output
    The minimum value is 9
    
    The maximum value is 1972
    
    The middle value is 19

1 comment: