Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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(,,) that takes 3 integer arguments and returns the day of the week and the month, formatted as in the example below. Save your function in a file q1.py. Below is an example output. This was done by opening the interpreter in the directory containing q1.py and then typing the following:

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

LO3 Name the seven categories of HR functions.

Answered: 1 week ago