Skip to the content

Coat or t-shirt?

Problem

Write a function that takes the temperature outside, in degrees Celsius, and returns what to wear: "coat" below 10 degrees, "jacket" from 10 to 25, and "t-shirt" above 25.

Both edges belong to the jacket: exactly 10 and exactly 25 give you "jacket". And it can drop below zero.

Examples

  • 3 → "coat"

  • 18 → "jacket"

  • 31 → "t-shirt"

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

You start with this

Python

def outfit(degrees):
    pass

JavaScript

function outfit(degrees) {
}
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 →