shreyasrikanth1
15.02.2021 •
Computers and Technology
Write a program that asks the user to enter a date in MM/DD/ format that is typical for the US, the Philippines, Palau, Canada, and Micronesia. For the convenience of users from other nations, the program computes and displays this date in an alternative DD.MM. format. Sample run of your program would look like this: Please enter date in MM/DD/ format: 7/4/1776 Here is the formatted date: 04.07.1776 You can assume that the user will enter correctly formatted date, but do not count on having 0s in front of one-digit dates. Hint: you will need to use string addition (concatenation) here.
Solved
Show answers
More tips
- S Style and Beauty What to Do When Hair Starts Falling Out?...
- H Health and Medicine Novomin: What is it and how to use it?...
- P Philosophy Unbelievable stories of encounters with otherworldly forces...
- L Leisure and Entertainment How to Choose the Perfect Gift for Men on February 23rd?...
- H Health and Medicine How to Treat Whooping Cough in Children?...
- H Health and Medicine Simple Ways to Lower Cholesterol in the Blood: Tips and Tricks...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
Answers on questions: Computers and Technology
- C Computers and Technology Lists You can also make lists that are filled with lists! List-ception. First, create three different lists: A list called string_list that contains three strings (can be...
- C Computers and Technology True or False, In adversarial searching, agents using the MiniMax algorithm always select the state that has the highest guaranteed net value....
- E English How does Fabio s relationship with Yusef and Andrew develop the theme of friendship in the story Tough Break ? Fabio s relationship with Yusef and Andrew shows that few friends...
- B Biology Changes in frequency & intensity of which types of major weather events have been observed in the past 50 years? Select one: a. droughts b. floods c. wildfires d. hurricanes...
- M Mathematics Qu elle est l écriture décimale de 5 puissance 2+2 puissance 2×9...
- C Computers and Technology 1. In Fig. 2-2, three process states are shown. In theory, with three states, there could be six transitions, two out of each state. However, only four transitions are shown....
- M Mathematics Which of the following could be an example of a function with a domain (-infinity ,infinity ) and a range (-0,4)?...
- M Mathematics Pls help it is due today...
- M Mathematics Find the slope of the line that passes through these two points: (14, -4) and (-4, 20) -3/4 3/4 4/13 -4/3...
- M Mathematics CAN SOMEONE PLEASE HELP ME...
Ответ:
In Python:
txt = input("Date in MM/DD/ format: ")
x = txt.split("/")
date=x[1]+"."
if(int(x[1])<10):
if not(x[1][0]=="0"):
date="0"+x[1]+"."
else:
date=x[1]+"."
if(int(x[0])<10):
if not(x[0][0]=="0"):
date+="0"+x[0]+"."+x[2]
else:
date+=x[0]+"."+x[2]
else:
date+=x[0]+"."+x[2]
print(date)
Explanation:
From the question, we understand that the input is in MM/DD/ format and the output is in DD/MM/ format/
The program explanation is as follows:
This prompts the user for date in MM/DD/ format
txt = input("Date in MM/DD/ format: ")
This splits the texts into units (MM, DD and )
x = txt.split("/")
This calculates the DD of the output
date=x[1]+"."
This checks if the DD is less than 10 (i..e 1 or 01 to 9 or 09)
if(int(x[1])<10):
If true, this checks if the first digit of DD is not 0.
if not(x[1][0]=="0"):
If true, the prefix 0 is added to DD
date="0"+x[1]+"."
else:
If otherwise, no 0 is added to DD
date=x[1]+"."
This checks if the MM is less than 10 (i..e 1 or 01 to 9 or 09)
if(int(x[0])<10):
If true, this checks if the first digit of MM is not 0.
if not(x[0][0]=="0"):
If true, the prefix 0 is added to MM and the full date is generated
date+="0"+x[0]+"."+x[2]
else:
If otherwise, no 0 is added to MM and the full date is generated
date+=x[0]+"."+x[2]
else:
If MM is greater than 10, no operation is carried out before the date is generated
date+=x[0]+"."+x[2]
This prints the new date
print(date)
Ответ:
Bill Gates and Paul Allen are the respective founders of Microsoft
Hope I Helped,
Pls Mark As Brainliest! : )