3. Date Printer
Write a program that reads string from the user containing a date in the form mm/dd/yyyy. It should print the date in the form March 12, 2014 .
( it is starting out with python third edition )
Can anyone please do it by python program .
Python Program:
def main():
"""
Function that accepts date in one
format and prints in another format
"""
# Reading date from user
date = input("\n Input date in the form mm/dd/yyyy:
");
# Splitting date on '/'
sDate = date.split('/');
# Extracting day, month, year
dd = sDate[1];
mm = int(sDate[0]);
yyyy = sDate[2];
# Dictionary that maps month from numeric to
string
months = {1:"January", 2:"February", 3:"March",
4:"April", 5:"May", 6:"June", 7:"July", 8:"August", 9:"September",
10:"October", 11:"November", 12:"December"};
# Checking for valid month
if mm in months.keys():
# If month is valid
month = months[mm];
# Forming new date
newDate = month + " " + dd + ", " +
yyyy;
# Printing date in specified
format
print("\n Date after formatting: "
+ newDate + " \n");
else:
# Invalid value for month
print("\n Invalid month \n");
# Calling main function
main();
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Sample Output:
3. Date Printer Write a program that reads string from the user containing a date in...
Python 3. Date Printer Write a program that reads a string from the user containing a date in the form mm/dd/yyyy. It should print the date in the format March 12, 2018 3. Date Printer Write a program that reads a string from the user containing a date in the form mm/dd/yyyy. It should print the date in the format March 12, 2018
Write a program that reads a string from the user containing a date in the form mm/dd/yyyy. It should print the date in the format March 12, 2018 I am asking for help in basic python please
IN PYTHON, Write a program that reads a string from the user containing a date in the form mm/dd/ yyyy. It should print the date in the form April 12, 2017. Hint: Get the "mm" from the user entered date "mm/dd/yyyy", then convert the "mm" into a month number. You may use an list month_list = ['January', 'February','March','April', 'May','June', 'July','August', 'September', 'October', 'November', 'December']. Use the month number you got from "mm" to get the month name.
# C PROGRAMMING LANGUAGEWrite a program that accepts a date from the user in the form mm/dd/yyyy and then dis- plays it in the form month dd, yyyy, where month is the name of the month: Enter a date (mm/dd/yyyy): 2/17/2011 You entered the date February 17, 2011 Store the month names in an array that contains pointers to strings.
Write a program that prompts the user to enter the date in mm/dd/yyyy format. The program should use a single input statement to accept the date, storing each piece of the date into an appropriate variable. Demonstrate that the input was obtained correctly by outputting the month, day, and year to the screen. Sample output: Enter (date (mm/dd/yyyy): 02/08/2011 Month entered: 2 Day entered: 8 Year entered: 2011 Challenge: Although the user entered 02, C++ drops the 0 as insignificant...
C Program Question 1: Write a program that reads a date from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format: mm/dd/yyyy Note that there is no space in the above format. A date in this format must be entered in one line. A valid...
5. Write a program in, "Python" that reads 2 numbers from the user. The program should then print out whether the first number is evenly divisible by the second number.
You will be developing a program that determines if a date is between a start and end date. Ask the user for a starting and ending date in the form of YYYY MM DD. Then ask the user for a date in the same form. If the date is between the starting and ending date, print "IN RANGE", otherwise print "OUT OF RANGE". Example Enter start date: 2017 1 24 Enter end date : 2019 1 24 Enter date :...
Question 1: Write a program in C that reads a date from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format: mm/dd/yyyy Note that there is no space in the above format. A date in this format must be entered in one line. A valid...
anyString.substr(x, n) - Returns a copy of a substring. The substring is n characters long and begins at position x of anyString. Write a program that reads a string from the user containing a date in the format mm/dd/yyyy. You have to use above substring method to extract the various fields from the format. It should print the date in the form Month Date, Year. Validate: Exit the program with error message as “Invalid date format” if length of...