# dateconvert.py Converts a date in form "mm/dd/yyyy" to "month day, year" #: def main(): # get the date dateStr = input ("Enter a date (mm/dd/yyyy): ") # split into components monthStr, dayStr,...

# Data conversion with format method(PYTHON) 1- As discussed in the chapter string formatting could be used to simplify the dataconvert2.py Redo this program making use of the string-formatting method. Please explain your answer I’m really confused??# dateconvert.py<br>Converts a date in form etrr500) "/>
Extracted text: # dateconvert.py Converts a date in form "mm/dd/yyyy" to "month day, year" #: def main(): # get the date dateStr = input ("Enter a date (mm/dd/yyyy): ") # split into components monthStr, dayStr, yearStr = dateStr.split("/") # convert monthStr to the month name months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] 5.8. Input/Output as String Manipulation 153 monthStr = months [int (monthStr)-1] * output result in month day, year format print ("The converted date is:", monthStr, dayStr+",", yearStr) main() When run, the output looks like this: Enter a date (mm/dd/yyyy): 05/24/2020 The converted date is: May 24, 2020 This example didn't show it, but often it is also necessary to turn a number into a string. In Python, most data types can be converted into strings using the str function. Here are a couple of simple examples: 20>etrr500)

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here