1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
olga_2 [115]
3 years ago
8

Write a program that asks the user to enter a date in MM/DD/YYYY format that is typical for the US, the Philippines, Palau, Cana

da, and Micronesia. For the convenience of users from other nations, the program computes and displays this date in an alternative DD.MM.YYYY format. Sample run of your program would look like this: Please enter date in MM/DD/YYYY 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.
Computers and Technology
1 answer:
stepladder [879]3 years ago
8 0

Answer:

In Python:

txt = input("Date in MM/DD/YYYY 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/YYYY format and the output is in DD/MM/YYYY format/

The program explanation is as follows:

This prompts the user for date in MM/DD/YYYY format

txt = input("Date in MM/DD/YYYY format: ")

This splits the texts into units (MM, DD and YYYY)

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)

You might be interested in
Ruth designs games for mobile operating systems such as iOS and Windows. The demand for games on mobile devices is high. Ruth’s
VMariaS [17]

Answer:

Viper Slash can be classified as a Question mark product

Explanation:

BCG matrix is a method developed by the Boston Consulting Group to analyze the strategic position and potential of businesses or products.

Business portfolios are evaluated using

  1. Relative market share
  2. Market growth rate

The result of the analysis is divided into four quadrants

  1. Dogs
  2. Cash cows
  3. stars and
  4. question marks

  1. Dogs: This comprises of business portfolios that operate in a slow-growing market. Investing in businesses in this quadrant is not advised due to their poor cash returns.
  2. Cash cows: These include business portfolios that provide high cash returns and should be milked.
  3. Stars: These are business portfolios that are operating in a fast-growing market and possess very high prospects of becoming cash cows.
  4. Question marks: are business portfolios that are underdogs in fast growing markets, they consume much cash but still, incurred losses. They don't gain many market shares despite high investments and have great tendencies to become dogs.

Ruth's Viper Slash falls into the Question marks category as the games section is a fast-growing market and struggle to gain market shares.

6 0
3 years ago
What is VoIP?
xeze [42]

Answer:

D. All of these are correct

Explanation:

VoIP transmits voice data packets over the internet. It is a low-cost option for receiving personal and business calls because it uses existing infrastructure that is the internet to transmit calls, unlike traditional telephone systems that require specialized equipment such as PBXs that are costly.VoIP also offers the ability to have more than one telephone number, as long as the bandwidth is enough, it allows multiple connections at any given time.

7 0
4 years ago
What is the name of the process that weighs the alternatives, gathers all necessary information, and can ultimately lead you to
blondinia [14]
This process is known as decision making.
8 0
3 years ago
Read 2 more answers
What does ip mean? internet protocol address internet program internet process (system software) internet prescience?
Mashutka [201]
Ip means internet protocol address
7 0
3 years ago
Which of the last step in conducting a URL search
kipiarov [429]
The user's browser renders the html code as a visual web page. A web page that we commonly see is structured by a bunch of 1 and 0. Rendering process allow the machine to interpret that 1 and 0 into the visual that we currently seeing Hope this helps. Let me know if you need additional help!
6 0
3 years ago
Other questions:
  • What sequence is used to create a brochure document from a template?
    8·2 answers
  • I need to create a function that returns Pascal's Triangle with n rows, where n is an int argument.
    12·1 answer
  • Ok so another weird question! So if you know what google drive is and how to upload a video why does it keep adding hours! it ke
    11·1 answer
  • Given the following HTML form snippet of markup, which of the following user inputs would meet the regular expression rule writt
    7·1 answer
  • A vehicle equipped with an electronically shifted transaxle stalls whenever slowing to a stop after being driven over 20 miles (
    15·1 answer
  • A feature that displays in the lower right corner of a selected range with which you can analyze your data by using Excel tools
    12·2 answers
  • Write a C++ program that stores the integers 50 and 100 in variables and stores the sum of these two in a variable named total.
    11·1 answer
  • If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
    11·2 answers
  • When determining how much money to borrow in loans to pay for your higher education, which of the following items should not be
    5·1 answer
  • Fill in the blanks to help write this professional e-mail:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!