Find if the Vacation can be taken or not | Function to find if the Vacation is possible or not ; Find the required number of hours of study ; find the hours of study that can be done if the vacation is taken ; check if the required hours are less than or equal to the hours of study that can be done if the vacation is taken ; Driver Code
def isPossible ( N , S , C , H , L , T ) : NEW_LINE INDENT total_time_required = S * C * H NEW_LINE available_time_after_vacation = ( N - L ) * T NEW_LINE if ( available_time_after_vacation >= total_time_required ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT return 0 NEW_LINE DEDENT N = 12 NEW_LINE S = 5 NEW_LINE C = 8 NEW_LINE H = 3 NEW_LINE L = 2 NEW_LINE T = 20 NEW_LINE if ( isPossible ( N , S , C , H , L , T ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT N = 1 NEW_LINE S = 2 NEW_LINE C = 3 NEW_LINE H = 4 NEW_LINE L = 5 NEW_LINE T = 6 NEW_LINE if ( isPossible ( N , S , C , H , L , T ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT