Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1115-41 (test leap. py) The year y is a leap ar if and only if ity s evenly divisible by 4 , but not by

image text in transcribed
1115-41 (test leap. py) The year y is a leap ar if and only if ity s evenly divisible by 4 , but not by 100-or ?fyis evenly divisible by 400. Define a bool function is leap (year) which returns True if year is a leap year, and False otherwise. Then write 10 different Py Test test functions, each of which tests a different year. Remember that each such test function must (a) have a name that starts with test_ (b) have no arguments, and (c) provide a test of the form assert is leap (YYYY) True if YYYY should be a leap year, or assert is leap (YYYYFalse if not. No main () function here: just the function definition and the 10 PyTest test methods. [H5-5) Gulian.py) Here's a way of calculating the Julian date daynum of a year, which is the ordinal number of any date within the year. For example, January I is always Julian date 1. February I is Julian date 32, and December 31 is Julian date 365 in non-leap years and 366 in leap years. Use int arithmetic in these calculations (1) daynum 31 (month-1) day (2) If the month is after February subtract (4month 23)/ 10 from daynum (3) If it's a leap year and after February 29, add I to daynum Using this algorithm, write a function julian (day,month, year) which returns the int Julian date of its arguments. Define a main( function which reads the date from the user as three separate int values: you don't have to verify that it's valid. Then call your function passing the three input arguments and print the result

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago