Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

v Part1: Shipwrecked! (8 points) Your ship crashes and you wake up alone on a deserted island. You realize that you lost your calender in

image text in transcribedimage text in transcribed
v Part1: Shipwrecked! (8 points) Your ship crashes and you wake up alone on a deserted island. You realize that you lost your calender in the wreck, and now face the extremely pressing issue of losing track of the date. Luckily, you remember today's date. Even more luckily, you stumble upon a working computer on the island. You think back to your CSE 101 class, and realize that you can write a Python function that calculates tomorrow's date. If you call this function every day, you can completely solve this problem! Complete the function tomorrows_date, which returns a string containing tomorrow's date. Assume that there are 12 months in a year, and 30 days in each month. Also, assume leap years don't exist (ideally, you wouldn't be stuck on the island until the next one, anyway). The function's input is of the format 'MM/DD/YYYY' , where each letter corresponds to one digit. The output will be of the same format, but leading zeroes don't matter. For example, ' 01/01/2021 ' isjust as correct as '1/1/2021' or even ' 01/1/2021 ' . First, separate the month, day, and year into three variables. Then, follow this logic: if month is 12 and day is 30: # so we advance the month, day, and year next day is '1/1/(year + 1)' elif day is 30: # therefore the month is NOT 12, so we advance the month and day next day is '(month + 1)/1/(year)' else: # we advance only the day next day is '(month)/(day + 1)/(year)' Examples: Function Call Return Value tomorrows_date ( '12/30/1999' ) '1/1/2000' or '01/01/2000' tomorrows_date( '01/30/1996') '2/1/1996' or '02/01/1996' tomorrows_date ( ' 11/20/2021' ) '11/21/2021' [ ] 1 def tomorrows_date ( today ) : 2 pass # DELETE THIS LINE and start coding here. W 5 # Test cases 6 print ( tomorrows_date ( '12/30/1999') ) 7 print ( tomorrows_date( '01/30/1996') ) 8 print ( tomorrows_date( '11/20/2021') )

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

Explain the role of ethics In marketing.

Answered: 1 week ago