Skip to the content

Ribbon around the frame

Problem

You're trimming a rectangular picture wide by tall centimeters with ribbon. The ribbon goes all the way around the edge and, on top of that, 10 centimeters go into the bow.

Write a function that returns how many centimeters of ribbon to buy.

A picture 10 by 5 needs 40. The 10 for the bow is added once, not once per side, and the measurements can come with decimals.

Examples

  • 10, 5 → 40

  • A square picture

    7, 7 → 38

  • Measurements with decimals

    12.5, 4 → 43

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def ribbon(wide, tall):
    pass

JavaScript

function ribbon(wide, tall) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →