Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help fixing this in Python, I can not get it to work. from datetime import datetime print (Python code to print out Date as

Need Help fixing this in Python, I can not get it to work.

from datetime import datetime print ("Python code to print out Date as a long data format") ipDate1 = input (' Please enter date in format mm/dd/yy: ')

month = ipDate1[2:] month1 = int(month) print(month1) while((month1 <1 ) & (month1> 12 )) : # then it is wrong keep reading if int(month1) < 1: print ( "Error , Month cannot be < 1, please re enter a valid month") if int(month1) > 12: print ( "Error , Month cannot be > 12, please re enter a valid month") ipDate1 = input (' Please enter date in format mm/dd/yy: ')

day = ipDate1[4:] day1 = int(day) print(day1) while((day1 <1 ) & (day1> 31 )) : # then it is wrong keep reading if int(day1) < 1: print ( "Error , Day cannot be < 1, please re enter a valid Day") if int(day1) > 31: print ( "Error , Day cannot be > 31, please re enter a valid Day") ipDate1 = input (' Please enter date in format mm/dd/yy: ')

year = ipDate1[-2:] year1 = int(year) if ( year1 != 13): print ("Error, year cannot be < 13 and cannot be > 13, please reenter year") ipDate1 = input (' Please enter date in format mm/dd/yy: ')

# convert the input date read in as a string into the datetime pattern as per the python built in object ipDate2 = datetime.strptime(ipDate1, "%m/%d/%y")

# now print out the date in the long format print (ipDate2.strftime("%B %d, %Y"))

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Identify the characteristics of fee simple ownership.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago