179k views
0 votes
You want to display a message letting customers know what day their purchase will be shipped. Assume, if your store promises "5 day shipping on all items!". Finally, print out Items purchased today will be shipped on YYYY- MM-DD (where the date is 5 days from the current date). import datetime

1. Create a variable today that holds the current date (no time)
2. Create a variable ships that holds the date five days from today Desired Output
3. Write the message shown in "Desired Output" to the screen Items purchased today will be shipped on YYYY-MM-DD

1 Answer

0 votes

Answer:

Following are the code to this question:

import datetime #import datetime

today=datetime.datetime.now().date()#define today variable that takes current date

ships=today+datetime.timedelta(days=5)#define ships variable that adds five days in the current date

print("The items are purchase today and it will be shipped on: ", ships)#print value or "Desired Output"

Output:

please find the attached file.

Step-by-step explanation:

In the above-given code, the "datetime" package is imported after that, two variable "today and ships" is defined.

In the "today" variable, a "datetime" is used, that uses the "date" method, that holds the current date value.

In the next step, the ships variable is defined, which uses today variable to add five days value into the current date, and print its value with the message.

You want to display a message letting customers know what day their purchase will-example-1
User Ricky Clarkson
by
6.3k points