Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement rect, which takes two positive integer arguments, perimeter and area. It returns the integer length of the longest side of a rectangle with integer

Implement rect, which takes two positive integer arguments, perimeter and area. It returns the integer length of the longest side of a rectangle with integer side lengths l and h which has the given permeter and area. If no such rectangle exists, it returns False.

The perimeter of a rectangle with sides la nd h is 2l+2h. The area is l*h

The built in function round takes a number as its argument and returns the nearest integer. For example, round 2.0 evaluates to 2, and round(2.5) evaluates to 3.

def rect(area,perimeter):

>>>rect(10,14) # A 2x5 rectangle

5

>>>rect(5,12)

5

>>>rect(25,20) #5x5 rectangle

5

>>>rect(25,25)# A 2.5x10 rectangle doesnt count because sides are not integers

False

>>>rect(25,29) # A 2x12.5 rectangle doesnt count because sides are not integers

False

>>> rect(100,50) # A 5x20 rectangle

20

side=1

while side*side ??? area:

other=round(???)

if ???:

???

side=side+1

return False

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

Students also viewed these Databases questions

Question

=+j Identify the challenges of training an international workforce.

Answered: 1 week ago