Question
[4 marks] In this question you will use Python datetime. You may use this webpage as a reference: https://www.w3schools.com/python/python_datetime.asp. To see how to format your
[4 marks] In this question you will use Python datetime. You may use this webpage as a reference: https://www.w3schools.com/python/python_datetime.asp. To see how to format your output string, use this reference:https://www.w3schools.com/python/python_string_formatting.asp.
Write a function date(
>>> from q1 import * >>> date(2020,8,13) That is a Thursday in the month of August. >>> date(1920,9,20) That is a Monday in the month of September.
You may change the wording if you like, but you must use the .format() function (or some other inline String formatting command) to print Strings.
Here is a bit of code to demonstrate what we are looking for and to get you started. Your file should look like this:
import datetime def date(year, month, day): date = datetime.datetime(year, month, day) # this print is for test purposes only print(date) # replace the line above with your code # The following line is a test case. |
# You may include test cases if you wish. # But for your submission we # only require the file containing the function date(1988, 10, 31) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started