Friday, February 1, 2019

May to August

  • Problem Description

    The length of a month varies from 30 and 31 days. 

    In this exercise you will create a program that reads the name of a month from the user as a string. 

    The program should get input from May to August.

    If the input is from may to other months then display error messages as "Invalid"

    Note:
    Use only if and elif
  • CODING ARENA
  • month=input()
    if(month=="Jun"):
        print("30")
    elif (month=="May","July","Aug"):
        print("31")
    else:
        ("Invalid")

  • Test Case 1

    Input (stdin)
    May
    
    
    Expected Output
    31
  • Test Case 2

    Input (stdin)
    Jun
    
    
    Expected Output
    30

No comments:

Post a Comment