Python exercise grade 10

Write a program that determines which dates comes earlier on the calendar. The user

may enter any number of dates. The user will enter 0/0/0 to indicate that no more dates

will be entered

Example:
Enter a date (month): 3

Enter a date (date): 6

Enter a date (year): 2008

03/06/2008

Enter a date (month): 5

Enter a date (date): 17

Enter a date (year): 2007

05/17/2007

Enter a date (month): 6

Enter a date (date): 3

Enter a date (year): 2007

06/03/2007

Enter a date (month): 0

Enter a date (date): 0

Enter a date (year): 0

5/17/2007 is the earliest date

Answers

Answer 1

earliest = ""

while True:

   month = int(input("Enter a date (month): "))

   day = int(input("Enter a date (date): "))

   year = int(input("Enter a date (year): "))

   if month == 0 and day == 0 and year == 0:

       break

   if month < 10:

       month = "0"+str(month)

   if day < 10:

       day = "0"+str(day)

   string_date = str(month)+"/"+str(day)+"/"+str(year)

   print(string_date)

   if earliest == "":

       earliest = string_date

   else:

       year,month,day=int(year),int(month),int(day)

       lst = list(map(int,earliest.split("/")))

       if year < lst[2]:

           earliest = string_date

       elif year == lst[2] and month < lst[0]:

           earliest = string_date

       elif year == lst[2] and lst[0] == month and day < lst[1]:

           earliest = string_date

print(earliest,"is the earliest date")

I wrote my code in python 3.8. Best of luck.


Related Questions

A system consumed 0.4 seconds of processor time, 0.3 seconds accessing the network, and 0.5 seconds accessing the disk drive to execute the task. Where is the bottleneck in this network

Answers

Answer:

the disk drive

Explanation:

A bottle neck in a network is the condition through which the data flows becomes limited by the network of the computer system. It occurs in the user network or within the servers where there are contention for any internal server resources.

In the context, a system that consumes 0.4 seconds for the processor time and time 0.3 seconds for accessing the network. The system also takes 0.5 seconds for accessing disk drive for executing the task. So the bottle neck in this system is the disk drive.

What does the “MIN” and “MAX” functions allow you to do when inserted in a spreadsheet?

Answers

Answer:

The MIN and MAX functions are just what the names imply. MIN will find the lowest number in a range, while MAX finds the largest number in a range. One advantage to these functions is that they can be combined with the IF function.

Explanation:

A pizza delivery restaurant decides to stop hiring drivers and start hiring cyclers to deliver its pizza. The restaurant thinks this will cut costs because it will not have to pay for gas. This is an example of which of the following supply chain management drivers?


A. information

B. facilities

C. transportation

D. inventory

Answers

Answer:

C. i think im sorry if  im wrong plz forgive

Who am I
1.I am the law established by the intellectual property organization
2.I am an application used to illegally harm online and offline computers users
3.I am the crime through the Internet
4. I impose restrictions on incoming and outgoing information to and from networks

Answers

1. Patent law or copyright
2. Malware
3. Cybercrime
4. Firewall

In order to create a chart, which of the following must be selected?
O Data tools
O Worksheet tab
O Data source
O Table styles

Answers

A chart is the graphical presentation of data and is a part of the data visualization. The data is represented by the symbols and bars in a bar chart.

They are often sued to show large quantities of data in a simple and understandable form. For making a chart first we need to select data tools and then design tools.

Hence the option A is correct.

Learn more about the order to create a chart.

brainly.com/question/22004535.

Check My Work Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What should Sherri consider prior to taking the laptop apart

Answers

Complete Question:

Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What should Sherri consider prior to taking the laptop apart? (Select all that apply.)

Group of answer choices.

a. Try an external device before replacing the motherboard.

b. Make sure you have the correct processor for the motherboard.

c. Verify that the laptop is not under warranty.

d. Determine whether a teardown procedure is available.

Answer:

b. Make sure you have the correct processor for the motherboard.

c. Verify that the laptop is not under warranty.

d. Determine whether a teardown procedure is available.

Explanation:

In this scenario, Sherri is considering replacing a processor on her laptop because the laptop is running slower than she would like.

Hence, Sherri should consider the following informations prior to taking the laptop apart;

I. Make sure you have the correct processor for the motherboard. She can get the specifications of the motherboard and processor on the manufacturer's website.

II. Verify that the laptop is not under warranty because if it still under warranty, taking the laptop apart would void the warranty granted by the original manufacturer.

III. Determine whether a teardown procedure is available. She should ensure there is a guide available for dismantling and re-coupling of the laptop.

Other Questions
Solve: 40 + -58Please help! Drake spent $540 on books. Math books cost $60 and science books cost $80. If he bought a total of 8 books, how many of each kind did he buy? Which model represents 2.36 4? A. Three groups of three tenths and four hundredths B. Three groups of five tenths and nine hundredths C. Four groups of three tenths and six hundredths D. Five groups of five tenths and nine hundredths Which model is to scale? *2 pointsABModel AModel B.Both models are to scale It's easier to resist at the beginning than at the end Leonardo da Vinci the ratio between the number of vowels and consonants letters of word ALERT is The number of protons in carbon (C) point (-4,-8) Reflected across the x-axis Why did who made cocomelon name it cocomelon and why are babies so addicted to it What are the raw materials for photosynthesis CAN SOMEONE PLEASE HELP ASAP What are resistors? A. magnets that are weakB. batteries that run radiosC. electrons that explodeD. materials that hold electrons HELP NEEDED ASAP!!! Early mixing systems had some severe limitations. Which of the following statements best describes one of thoselimitations:1. They could not fast forward.2. They could not edit.3. They could not play more than one track at a time.4. They could not play in reverse. 2. Identify Patterns What is the metaphor that Thoreau uses to describe civilized life in lines 49-54? Where else is a similar metaphor used in the text? PLEASE HELP!At a bus station, buses begin their routes at 6:00 AM. The schedule for 2 of the buses is based on the time intervals listed below:Bus A has a long route and leaves the station every 45 minutes.Bus B has a short route and leaves the station every 30 minutes.What is the next time that both Bus A and Bus B will leave the bus station at the same time?Group of answer choices7:00 AM7:30 AM7:15 AM8:30 AM Explain what happens to the gravitational force between two objects if (a) The mass of one object is doubled,(b) The distance between the object is tripled.Please its aurgent Alonzo will rent a car for the weekend. He can choose one of two planes. The first plan has an initial fee of $38 and cost an additional $.12 per mile driven the second plan has an initial fee of $49 in cost an additional seven cents per mile driven. What amount of drive into the two plans cost the same? What is the cost when the two plans cost the same? It is your task to make sure they are corrected. Choose one of the newspaper headlines. You will rewrite the headline and a one-to-two-paragraph article to make the news scientifically correct. Be sure to include the following in your corrected newspaper article:New title reflecting correct informationDetailed information about the processes and tectonic plate interactions that are causing the geological event to occur. Include an explanation of convection currents.Real-world example of where to find the geological event on Earth (picture and location)Also review the grading rubric before you begin.Newspaper with headline of Shake, Rattle, and Roll: Giants Battling Zeus Create Catastrophic Earthquake. Image of an earthquake damage in a cityNewspaper with headline of Explosive Situation: Fire- Breathing Dragon Caught Inside Mountain Creates Volcanic Eruption. Image of a dragon breathing fireNewspaper with headline of Islands Popping Up Everywhere, Maui uses giant hook to pull islands from the ocean. Image of an island in the oceanNewspaper with headline of Ocean Expansion: Poseidon Pushes Tectonic Plates Apart, Creating an Ocean. Image of a wave in the ocean Solve the system using elimination:3x + 2y = 9x + y = 4 . Complete the congruence statement.. Complete the congruence statement.. Complete the congruence statement.. Complete the congruence statement.