Question: Please help solve python # DESCRIPTION: This generates 3 random date/time options for the user. # Dates must be: # - in a future month

Please help solve python

Please help solve python # DESCRIPTION: This generates 3 random date/time options

# DESCRIPTION: This generates 3 random date/time options for the user. # Dates must be: # - in a future month (and perhaps that's a future year) # - in the next 3 months from this month, but NOT the current month. # This starter code is currently in a working state. # OUTPUT REPORT: """ TODAY IS: 02-16-2021 09:30 am YOUR OPTIONS: 03-19-2021 at 05:49 pm 04-22-2021 at 11:31 am 04-19-2021 at 06:59 am THE END """ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - imports import get_random_pieces

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main function # THE PLAN: # call get current date/time (storing returned results) # print line 2 of report i.e. "YOUR OPTIONS:" # loop to do the 3 date/time lines: # call generate 1 date/time (sending in the 5 integers for today) # print THE END def main(): day, month, year, hour, minute = get_today()

# - - - - - - - - - - - - - - - - - - - - - - - - - - - get current date/time def get_today(): datetime_str = "02-16-2021 09:30 am" print("TODAY IS: ", datetime_str) month = int(datetime_str[0:2]) day = int(datetime_str[3:5]) year = int(datetime_str[6:10]) hour = int(datetime_str[11:13]) minute = int(datetime_str[14:16]) return day, month, year, hour, minute

# - - - - - - - - - - - - - - - - - - - - - - - - generate 1 date/time option # THE PLAN: # 1) call 5 functions to generate random data for the 6 items: # get_month_year, get_day, get_hour, get_ampm, get_minute # NOTES: # - get_month_year() needs current month & year as arguments # - get_month_year() will return 2 values # - get_day() needs the NEW month that the function get_month_year() returned # - get_day(), get_hour(), get_minute(), get_ampm() each return 1 value # 2) print 1 detail line in the report, e.g., 02-19-2021 at 05:49 pm def generate_single_date_time(day, month, year, hour, minute): pass

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main()

for the user. # Dates must be: # - in a future

# DESCRIPTION: This module contains 5 functions which generate 6 items # month, year, day, hour, minute, ampm # using randint function (in imported random module), making sure that # the values are within the legal range for that item. # A typical line which main program prints: 11-20-2019 at 06:59 am # ----------------------------------------------------------------------------

import random

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET MONTH & YEAR # MONTH ISSUES: # Should be within the next 3 months, but NOT the current month # Should allow for going over into the new year. # # YEAR ISSUES: # Has to be decided based on the month. # The year returned would be the year sent in, MOST of the time EXCEPT # when month flowed over into the next year - i.e., # current_month > random_month # Parameter: month, year

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET DAY # DAY ISSUES: When generating a random number, it has to be within the legal # range for the NEW month (parameter sent in) - so the stopping value for # the end point of the range would be: # 31 - the default since that's most months' last day # 30 for April (4), June (6), September (9), November (11) # 28 for February (forget leap year for now) # Parameter: month

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET HOUR # HOUR ISSUES: A valid hour - 00 isn't valid - that would be 12

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET MINUTE # MINUTE ISSUES: A valid minute - 00 is valid, but 60 is not valid

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET AM PM # am pm ISSUES: am or pm - (use randint 0 or 1)

# DESCRIPTION: This generates 3 random date/time options for the user. # Dates must be: # in a future month (and perhaps that's a future year) # - in the next 3 months from this month, but NOT the current month. # This starter code is currently in a working state. # OUTPUT REPORT: TODAY IS: 02-16-2021 09:30 am YOUR OPTIONS: 03-19-2021 at 05:49 pm 04-22-2021 at 11:31 am 04-19-2021 at 06:59 am THE END imports # import get_random_pieces # main function # THE PLAN: call get current date/time (storing returned results) # print line 2 of report i.e. "YOUR OPTIONS: # loop to do the 3 date/time lines: # call generate 1 date/time (sending in the 5 integers for today) # print THE END def main(): day, month, year, hour, minute = get_today() get current date/time # def get_today(): datetime_str = "02-16-2021 09:30 am print("TODAY IS: ", datetime_str) month = int(datetime_str(0:2]) day = int(datetime_str[3:5]) year = int(datetime_str[6:10]) hour = int(datetime_str(11:13]) minute = int(datetime_str[14:16]) return day, month, year, hour, minute # # # generate 1 date/time option # THE PLAN: # 1) call 5 functions to generate random data for the 6 items: # get_month_year, get_day, get_hour, get_ampm, get_minute NOTES: get_month_year() needs current month & year as arguments # - get_month_year() will return 2 values # - get_day() needs the NEW month that the function get_month_year() returned # - get_day(), get_hour(), get_minute(), get_ampm() each return 1 value # 2) print 1 detail line in the report, e.g., 02-19-2021 at 05:49 pm def generate_single_date_time(day, month, year, hour, minute): pass # main # DESCRIPTION: This module contains 5 functions which generate 6 items # month, year, day, hour, minute, ampm # using randint function (in imported random module), making sure that # the values are within the legal range for that item. # A typical line which main program prints: 11-20-2019 at 06:59 am # import random # GET MONTH & YEAR # MONTH ISSUES: # Should be within the next 3 months, but NOT the current month # Should allow for going over into the new year. # # YEAR ISSUES: # Has to be decided based on the month. # The year returned would be the year sent in, MOST of the time EXCEPT # when month flowed over into the next year - i.e., # current_month > random_month # Parameter: month, year # - GET DAY # DAY ISSUES: When generating a random number, it has to be within the legal # range for the NEW month (parameter sent in) - so the stopping value for # the end point of the range would be: # 31 - the default since that's most months' last day # 30 for April (4), June (6), September (9), November (11) # 28 for February (forget leap year for now) # Parameter: month GET HOUR # # HOUR ISSUES: A valid hour 00 isn't valid - that would be 12 GET MINUTE # # MINUTE ISSUES: A valid minute 00 is valid, but 60 is not valid - GET AM PM # # am pm ISSUES: am or pm (use randint 0 or 1) # DESCRIPTION: This generates 3 random date/time options for the user. # Dates must be: # in a future month (and perhaps that's a future year) # - in the next 3 months from this month, but NOT the current month. # This starter code is currently in a working state. # OUTPUT REPORT: TODAY IS: 02-16-2021 09:30 am YOUR OPTIONS: 03-19-2021 at 05:49 pm 04-22-2021 at 11:31 am 04-19-2021 at 06:59 am THE END imports # import get_random_pieces # main function # THE PLAN: call get current date/time (storing returned results) # print line 2 of report i.e. "YOUR OPTIONS: # loop to do the 3 date/time lines: # call generate 1 date/time (sending in the 5 integers for today) # print THE END def main(): day, month, year, hour, minute = get_today() get current date/time # def get_today(): datetime_str = "02-16-2021 09:30 am print("TODAY IS: ", datetime_str) month = int(datetime_str(0:2]) day = int(datetime_str[3:5]) year = int(datetime_str[6:10]) hour = int(datetime_str(11:13]) minute = int(datetime_str[14:16]) return day, month, year, hour, minute # # # generate 1 date/time option # THE PLAN: # 1) call 5 functions to generate random data for the 6 items: # get_month_year, get_day, get_hour, get_ampm, get_minute NOTES: get_month_year() needs current month & year as arguments # - get_month_year() will return 2 values # - get_day() needs the NEW month that the function get_month_year() returned # - get_day(), get_hour(), get_minute(), get_ampm() each return 1 value # 2) print 1 detail line in the report, e.g., 02-19-2021 at 05:49 pm def generate_single_date_time(day, month, year, hour, minute): pass # main # DESCRIPTION: This module contains 5 functions which generate 6 items # month, year, day, hour, minute, ampm # using randint function (in imported random module), making sure that # the values are within the legal range for that item. # A typical line which main program prints: 11-20-2019 at 06:59 am # import random # GET MONTH & YEAR # MONTH ISSUES: # Should be within the next 3 months, but NOT the current month # Should allow for going over into the new year. # # YEAR ISSUES: # Has to be decided based on the month. # The year returned would be the year sent in, MOST of the time EXCEPT # when month flowed over into the next year - i.e., # current_month > random_month # Parameter: month, year # - GET DAY # DAY ISSUES: When generating a random number, it has to be within the legal # range for the NEW month (parameter sent in) - so the stopping value for # the end point of the range would be: # 31 - the default since that's most months' last day # 30 for April (4), June (6), September (9), November (11) # 28 for February (forget leap year for now) # Parameter: month GET HOUR # # HOUR ISSUES: A valid hour 00 isn't valid - that would be 12 GET MINUTE # # MINUTE ISSUES: A valid minute 00 is valid, but 60 is not valid - GET AM PM # # am pm ISSUES: am or pm (use randint 0 or 1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!