Whole Degrees Only

Data with PythonMedium+10 XP+10

Whole Degrees Only

A weather station sends its temperature readings as text, like "12.5", "7" or "-3.7". The display can only show whole degrees.

Task: write whole_degrees(readings). readings is a list of strings, and each string is a number. Return the readings as whole numbers, as a plain list, in the same order.

Turn each reading into a whole number by cutting off everything after the decimal point. Don't round. So "12.9" becomes 12, and "-3.7" becomes -3.

There is always at least one reading.

Examples

readings = ["12.5", "7", "-3.7", "0.9"]
returns [12, 7, -3, 0]
readings = ["21", "19.99", "100.0"]
returns [21, 19, 100]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run