Question

Python Coding

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



0 0
Add a comment Improve this question Transcribed image text
Answer #1

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")


answered by: Satyam Keshri
Add a comment
Know the answer?
Add Answer to:
Python Coding
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python Coding problem

    Tracking the Shipment DatesRadan Logistics is a mid sized Shipping Company known for its Customer oriented delivery services. The Company Management intended to place an information kiosk in their Head Office which would help their Customers to fetch all the desired information with regards to their shipment. One such vital information that Customers would prefer to know is the details of the working days of the Company which would help them track their shipments.Help the Management write a program for...

  • Solve by using Python language Validation of Invoice Number The Gocargo carriers are extending their automation...

    Solve by using Python language Validation of Invoice Number The Gocargo carriers are extending their automation to their accounts wing too, It is difficult to identify the source and destination of a cargo in an invoice. So given an invoice number, determine the "from" and "to" for a cargo. The format of invoice number is as follows: * from-Country and to-Country are separated by few digits(atleast 1) * after to-Country there are few digits. Input Format :       Input consists...

  • Python coding

    Palindromic CargoThe Gocargo carriers are celebrating their digitization process, which has given them a lot of benefits and ease of work for their employees. In account of this initiative they are offering their customers to ship their cargoes free of cost, if and only if the cargo names are palindromic.Given a cargo name, check whether the cargo name is a palindrome or not. Consider only alphabets while checking, remove special characters and spaces.Note : Define a function named check Palindrome()...

  • Python Coding

    The Cargo arrangementThe Gocargo carriers have a pattern of arranging the cargos in the container. Given the length of edge of the container, print the cargo arrangement pattern in the container as shown in the sample IO. The base of the container is always a square.Note: The Cargo are of unit length.Input format :     The input is an integer that corresponds to the side length of the container.Output Format:     Output is the cargo arrangement pattern inside the container.Please refer to the sample...

  • Python coding

    The Weight Detection SensorThe Gocargo carriers has planned to automate the filling of cargos in the container. They have installed a weight detection sensor in the conveyor belt where cargos will be taken to the container. The sensor needs to be programmed in a way that it stops the conveyor sending the cargos, when the maximum capacity of the container is reached or exceeded.Please write a code to enable the sensor to automate this task of finding the number of...

  • Write a Python program named aIP.py which will read data from a file named wireShark.txt and...

    Write a Python program named aIP.py which will read data from a file named wireShark.txt and extract all the pairs of source and destination ip addresses and output them in pairs to another file called IPAddresses.txt , one per line, listing source and destination. Example of output: Source                      Destination 192.168.1.180         239.255.255.250 Detailed Requirements: You will read from a file called wireShark.txt which, to avoid problems with finding paths, will be located in the same directory as your code You will...

  • Help with this coding problem. Please in python Thank you You are choreograhing a circus show with various animals. For...

    Help with this coding problem. Please in python Thank you You are choreograhing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location x1 and moves at a rate of v1 meters per jump. The second kangaroo starts at location x2 and moves at a rate of v2 meters per jump. You have to figure...

  • CODING IN JAVA Dates are printed in several common formats. Two of the more common formats...

    CODING IN JAVA Dates are printed in several common formats. Two of the more common formats are: 07/21/55 and July 21, 1955 Write a program that reads a date in the first format and prints that date in the second format. Prompt the user and accept user input for the date in MM/DD/YYYY format. Retrieve the month portion of the date entered and convert it to an integer. Do the same thing for day and year Create a string named...

  • Code with Java using arrays and Scanner only ( input should end with 0 to terminate...

    Code with Java using arrays and Scanner only ( input should end with 0 to terminate the program) Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social interaction among co-workers, foster friendship among classmates or even strengthen bond between families. Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, candles with names, or it can be in the form of simple bar chart to indicate the birthday...

  • Java code BIRTHDAY GRAPH5 4B Input Standard input Output Standard output Topic Array & Array Processing...

    Java code BIRTHDAY GRAPH5 4B Input Standard input Output Standard output Topic Array & Array Processing Birthday Graph Problem Description Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social E interaction among co-workers, foster friendship among classmates or even strengthen bond between E BOBO Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, UU candles with names, or it can be in the form of simple bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT