Friday, February 1, 2019

September to December

  • 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 September to December.I

    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=="Sep"):
        print("30")
    elif(month=="Nov"):
        print("30")
    elif(month=="Oct","Dec"):
        print("31")
    else:
        ("Invalid")

  • Test Case 1

    Input (stdin)
    Sep
    
    
    Expected Output
    30
  • Test Case 2

    Input (stdin)
    Oct
    
    
    Expected Output
    31

No comments:

Post a Comment