Question: How can I code this in Python with only if-statements? ( Only allowed to use the built-in functions int(), float(), and str(), and without using

How can I code this in Python with only if-statements? (Only allowed to use the built-in functions int(), float(), and str(), and without using loops or range.)

def tile_fitting(num_small, num_large, length)

Description: You have tiles of two different fixed sizes, 1ft and 5ft long, and you want to decide whether a certain number of these tiles can fit exactly a certain length (we do not care about the other dimension). Its ok if you have more tiles than needed but not the opposite obviously.

Parameters: num_small (int) is the amount of the available small tiles (1ft), num_large (int) is the amount of the available large tiles (5ft), and length (int) is the length (in ft) you want to cover.

Return value: True if the available tiles can fit exactly the given length and False otherwise.

Examples:

tile_fitting(5,4,11) True

tile_fitting(1,3,13) False

tile_fitting(0,3,10) True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!