Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help! I'm struggling with this question for my computer science class and it's a python coding class! Exercise 5.3 Date Types and Multiple Returns Write

Help! I'm struggling with this question for my computer science class and it's a python coding class!

Exercise 5.3 Date Types and Multiple Returns

Write a program named date_types.py that has one function date_analysis that returns a tuple of characteristics about the numbers it is passed.

The first parameter weekday will be the day of the week in numerical format (1--7) where 1 is Sunday, 2 is Monday, ... 7 is Saturday

A second parameter month will be the month number (1--12) that represents the months January--December.

A third parameter mo_date will be the day in the month 1--31 that represents the day of the month.

Your function should return a tuple with 3 values:

The first value will be the type of day ('weekday' or 'weekend', or return 'invalid' if outside the range of 1--7).

The second value will be the season (Fall [Sep--Nov], Winter [Dec--Feb], Spring [Mar--May], Summer [Jun--Aug], or Invalid if outside that range).

The third value will be the portion of the month the date falls (0 for a number lower than one, 1 for 1st quarter, 2 for 2nd quarter, 3 for 3rd quarter, 4 for 4th quarter, or 5 for anything higher).

Notice that lowercase 'invalid' means the weekday was out of range, and uppercase 'Invalid' means the month was out of range.

image text in transcribed

Write a program named date_types.py that has one function date_analysis that returns a tuple of characteristics about the numbers it is passed. The first parameter weekday will be the day of the week in numerical format (1-7) where 1 is Sunday, 2 is Monday, ... 7 is Saturday A second parameter month will be the month number (1-12) that represents the months January--December. A third parameter mo_date will be the day in the month 1--31 that represents the day of the month. Your function should return a tuple with 3 values: - The first value will be the type of day ('weekday' or 'weekend', or return 'invalid' if outside the range of 1-7). - The second value will be the season (Fall [Sep--Nov], Winter [Dec--Feb], Spring [Mar--May], Summer [Jun--Aug], or Invalid if outside that range). - The third value will be the portion of the month the date falls ( 0 for a number lower than one, 1 for 1 st quarter, 2 for 2 nd quarter, 3 for 3 rd quarter, 4 for 4 th quarter, or 5 for anything higher). Notice that lowercase means the weekday was out of range, and uppercase means the month was out of range

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago