Code Monkey home page Code Monkey logo

autograder-1's Introduction

# AutoGrader
Assignment 2
### YOUR CODE FOR calculateArea() FUNCTION GOES HERE ###
def calculateArea(length, width):
    return length * width

#### End OF MARKER



### YOUR CODE FOR checkTilesFit() FUNCTION GOES HERE ###
def checkTilesFit(plot_length, plot_width, tile_length, tile_width):
    plot_area = calculateArea(plot_length, plot_width)
    tile_area = calculateArea(tile_length, tile_width)
    if plot_area % tile_length == 0.0 and plot_area % tile_width == 0.0 and plot_length > 0 and plot_width > 0 and tile_length > 0 and tile_width > 0:
        return True
    else: 
        return False

#### End OF MARKER



### YOUR CODE FOR calculateTiles() FUNCTION GOES HERE ###
def calculateTiles(plot_length, plot_width, tile_length, tile_width):
    if type(plot_length) == str or type(plot_width) == str or type(tile_length) == str or type(tile_width) == str:
        return "Invalid Input"
    elif plot_length == 0 or plot_width == 0 or tile_length == 0 or tile_width == 0:
        return None
    plot_area = calculateArea(plot_length, plot_width)
    tile_area = calculateArea(tile_length, tile_width)
    number_of_tiles = plot_area // tile_area
    print(number_of_tiles)
    tiles_fit = checkTilesFit(plot_length, plot_width, tile_length, tile_width)
    print(tiles_fit)
    if type(number_of_tiles) == int and tiles_fit == True:
        return number_of_tiles
    else:
        return "Not Possible"

#### End OF MARKER



autograder-1's People

Contributors

irsakhan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.