Python 3.7.4:I'm wasting a second request for the same question because the person who answered the first one didn't pay attention to the question and won't respond to the comments.  I appreciate the help, I just ask that the question gets read in its entirety before you answer it.  Thank you for your help.----------------------The original assignment was to write a program that requests a year as input and states whether it is a leap year only using a while loop.  The new assignment is to take that same program and re-write it using functions.  ---------------------------Below is my original program. I need to change it so that it now has a main() function plus three more functions. It must be main() and nothing more advanced than that. The instructor said that it was a bad habit to include "break" in loops, so I was able to eliminate that. ''' Determine if a given year is a leap year, running as many times as the user wants to check for leap years'''# instructionsprint('This program determines if a given year is a leap year.')year= input("Enter year or stop to exit: ")# processwhile year.upper() != "STOP": # provides a break to the loop    if int(year) % 400 == 0: # check if the year entered by user is a leap year or not        print(year,"is a leap year")    elif int(year) % 100 == 0:        print(year, "is not a leap year")    elif int(year)%4 == 0:        print(year,"is a leap year")# output    else:        print(year, "is not a leap year")    year= input("Enter year or stop to exit: ")print("Thank you.")---------------------------I think that with the new program I need to use something like:def main():def isLeapYear():def close():def retry():But I keep messing it up.

Question
Asked Nov 12, 2019
51 views

Python 3.7.4:

I'm wasting a second request for the same question because the person who answered the first one didn't pay attention to the question and won't respond to the comments.  I appreciate the help, I just ask that the question gets read in its entirety before you answer it.  Thank you for your help.

----------------------

The original assignment was to write a program that requests a year as input and states whether it is a leap year only using a while loop.  The new assignment is to take that same program and re-write it using functions.  

---------------------------

Below is my original program. I need to change it so that it now has a main() function plus three more functions. It must be main() and nothing more advanced than that. The instructor said that it was a bad habit to include "break" in loops, so I was able to eliminate that. 

''' Determine if a given year is a leap year, running as many times as the user wants to check for leap years'''

# instructions
print('This program determines if a given year is a leap year.')
year= input("Enter year or stop to exit: ")

# process
while year.upper() != "STOP": # provides a break to the loop
    if int(year) % 400 == 0: # check if the year entered by user is a leap year or not
        print(year,"is a leap year")
    elif int(year) % 100 == 0:
        print(year, "is not a leap year")
    elif int(year)%4 == 0:
        print(year,"is a leap year")

# output
    else:
        print(year, "is not a leap year")
    year= input("Enter year or stop to exit: ")
print("Thank you.")

---------------------------

I think that with the new program I need to use something like:

def main():
def isLeapYear():
def close():
def retry():

But I keep messing it up.

check_circle

Expert Answer

Step 1

This question asks about to check year is Leap year or not. So, let's know about Leap Year :

 Leap Year: If the following conditions are met, a year is a leap year:

  1. A Year is multiple of 400.
  2. A Year is multiple of 4 and not multiple of 100.

...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: Python 3.7.4 Write a statement to open the file priceList.txt for writing.

A: To open the file priceList.txt for writing, the statement is: f=open('priceList.txt','w')The followi...

question_answer

Q: for C++ write a progam for the greatest common divisor of integers x and y is the largest integer th...

A: program to find the greatest common divisor of x and y.if x is 0 then answer is y.if y is 0 then the...

question_answer

Q: <pre>SELECT CUSTOMER_T. CUSTOMER_ID,ORDER_T. CUSTOMER_ID, NAME, ORDER_IDFROM CUSTOMER_T,ORDER_...

A: SELECT CUSTOMER_T. CUSTOMER_ID,ORDER_T. CUSTOMER_ID, NAME, ORDER_IDFROM CUSTOMER_T, ORDER_TWHERE CUS...

question_answer

Q: write a c++ program: Create an array with 11 integers, which will be randomly selected from the rang...

A: In the CPP program crate an array with 11 sizes.The array elements are integer types.The elements ar...

question_answer

Q: Let s1 be " Welcome " and s2 be " welcome ". Write the code for the following statements:a. Check wh...

A: We’ll answer the first three subparts of the question since the exact one wasn’t specified. Please s...

question_answer

Q: Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every yea...

A: In order to correct given program, make the following changes:Put def main() code above the def leap...

question_answer

Q: Write a Python program for an online MoonBucks coffee order. Coffee is sold by the pound, and the pr...

A: Algorithm:Following is the python program that takes as input from user the number of pounds to be o...

question_answer

Q: For the following problems assume 1 kilobyte (KB) 1024 kilobytes. 1024 bytes and 1 megabyte (MB) For...

A: (a) The last bits of virtual address are called offset. And for a 4K page, the number of bits will b...

question_answer

Q: During garbage collection, what setting controls how long deleted objects remain within the database...

A: The container object tombstone contains deleted objects from Active directory. An object that is del...