1 answer

Python Coding

Question:

Expiry Date

At Transglobal Logistics, a commodity will be accepted for shipment only if it reaches the destination before the expiry date. Find whether a commodity is accepted for shipping, based on the expiry date, departure date of the commodity from the Source port and number of days required to reach the destination port.



Input Format:

First line is a string that corresponds to the expiry date.

Second line is a string that corresponds to the departure date of the commodity from the source port.

Third line is an integer that corresponds to the number of days required to reach the destination.


Output Format:

Print "Yes", if the commodity is acceptable for shipping, else "No".


Sample Input 1 :

Aug 23 2014

Jul 1 2014

60

Sample Output 1 :

No


Sample Input 2 :

Aug 23 2014

Jul 1 2014

6

Sample Output 2 :

Yes



Answers

from datetime import date


'''Aug 23 2014


Jul 1 2014


60'''

def Month_As_Int(month):

    if(month=="Jan"):

        return 1

    elif(month=="Feb"):

        return 2

    elif (month == "Mar"):

        return 3

    elif (month == "Apr"):

        return 4

    elif (month == "May"):

        return 5

    elif (month == "Jun"):

        return 6

    elif (month == "Jul"):

        return 7

    elif (month == "Aug"):

        return 8

    elif (month == "Sep"):

        return 9

    elif (month == "Oct"):

        return 10

    elif (month == "Nov"):

        return 11

    elif (month == "Dec"):

        return 12




expiry_date=input()

departure_date=input()

number_of_days=int(input())


exp_date=date(int(expiry_date.split(" ")[2]),Month_As_Int(expiry_date.split(" ")[0]),int(expiry_date.split(" ")[1]))

dept_date=date(int(departure_date.split(" ")[2]),Month_As_Int(departure_date.split(" ")[0]),int(departure_date.split(" ")[1]))


diff_of_day=(exp_date-dept_date).days


if(number_of_days>diff_of_day):

    print("No")

elif(number_of_days<diff_of_day):

    print("Yes")


.

Similar Solved Questions

1 answer
The probability that a 25-year-old female in the U.S. will die within one year is about...
The probability that a 25-year-old female in the U.S. will die within one year is about 0.000514. An insurance company is preparing to sell a 25-year-old female a one-year, $40,000 life insurance policy. How much should it charge for its premium in order to have a positive expectation for the policy...
1 answer
Why does optic nerve cause a blind spot?
Why does optic nerve cause a blind spot?...
1 answer
Pot Inc. acquired all Seed Inc.'s outstanding $25 par common stock on December 31, 20X3, in...
Pot Inc. acquired all Seed Inc.'s outstanding $25 par common stock on December 31, 20X3, in exchange for 41,000 shares of its $25 par common stock. Pot's common stock closed at $57.50 per share on a national stock exchange on December 31, 20X3. Both corporations continued to operate as separ...
1 answer
Suppose U.S. consumers 21 years and older consumed 26.8 gallons of beer and cider per person...
Suppose U.S. consumers 21 years and older consumed 26.8 gallons of beer and cider per person during 2017. A distributor in Milwaukee believes that beer and cider consumption are higher in that city. A sample of consumers 21 years and older in Milwaukee will be taken, and the sample mean 2017 beer an...
1 answer
The difference between a standard score of -1.0 and a standard score of 1.0 is a)...
The difference between a standard score of -1.0 and a standard score of 1.0 is a) the standard score 1.0 is farther from the mean than -1.0 b) the standard score -1.0 is farther from the mean than 1.0 c) the standard score 1.0 is above the mean while -1.0 is below the mean. d) the standard score -1....
1 answer
Write a detailed note on "Millennium Development goals", Use the APA format you can seach for...
Write a detailed note on "Millennium Development goals", Use the APA format you can seach for it online and it should be minimum about 1000 words. This topic comes under "Health Economics"....
1 answer
How do intrusion detection systems differ from intrusion prevention systems? Give an example from either a...
How do intrusion detection systems differ from intrusion prevention systems? Give an example from either a network or a host point of view...
3 answers
I have to write an expository essay on Phoebe Winterbottom, from Walk Two Moons, analyzing her character
I have to write an expository essay on Phoebe Winterbottom, from Walk Two Moons, analyzing her character. This is what I have: Pheobe Winterbottom is a nervous girl who recieves mysterious messages, meets a “lunatic”, and whose mother goes away in the novel Walk Two Moons. Phoebe is bot...
1 answer
Consider the following figure. A B D Given: AB || DC DB bisects LADC mLA =...
Consider the following figure. A B D Given: AB || DC DB bisects LADC mLA = 1200 m23 in degrees Find: m2.3 = o...
1 answer
Discuss the important considerations in the selection of materials for packaging of an implantable biosensor.
Discuss the important considerations in the selection of materials for packaging of an implantable biosensor....
1 answer
Identifytwo common requirements of critical incident policies and procedures relating to behaviour management
identifytwo common requirements of critical incident policies and procedures relating to behaviour management...
1 answer
Brazilains are quite familiar with fueling their automobiles with ethanol, a fermentation product from sugarcane. Calculate...
Brazilains are quite familiar with fueling their automobiles with ethanol, a fermentation product from sugarcane. Calculate the standard molar enthalpy for the complete combustion of liquid ethanol (C2H5OH) using the standard enthalpies of formation of the reactants and the products. C2H5OH (l) + 3O...
1 answer
Bank Reconciliation The company's accounting intern has prepared the end-of-January bank reconciliation from the bank statement,...
Bank Reconciliation The company's accounting intern has prepared the end-of-January bank reconciliation from the bank statement, and is worried because the adjusted balance amounts do not agree. After reviewing the bank reconciliation, scroll down for the next steps in helping the intern. Murdst...