Friday, February 1, 2019

Grade System

  • Problem Description

    Write a python function to calculate the GRADE systems of marks

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output

    Input :
    Input 5 numbers

    Output:

    1. If the average is above 90 then print Grade as "A" (Hint : 90 and above)
    2. If the average is above 70 and less than 90 then print Grade as "B" (Hint: 71-89)
    3. If the average is above 50 and less than 70 then print Grade as "C"(Hint: 51-70)
    4. If the average is 50 or less then then print as "D"
  • CODING ARENA
  • a=int(input())
    b=int(input())
    c=int(input())
    d=int(input())
    e=int(input())
    n=(a+b+c+d+e)/5

    if(n>=90):
        print("Grade:A")
    elif(n>=71 and n<90):
        print("Grade:B")
    elif(n>=51 and n<71):
        print("Grade:C")
    else:
        print("Grade:D")


  • Test Case 1

    Input (stdin)
    99
    
    98
    
    87
    
    99
    
    90
    
    
    Expected Output
    Grade:A
  • Test Case 2

    Input (stdin)
    71
    
    77
    
    67
    
    89
    
    89
    
    
    Expected Output
    Grade:B

No comments:

Post a Comment