Results for “int”

Showing 1–10 of 124

  1. Challenge

    Round or cut?

    int() cuts the decimals off, round() rounds, and round(2.5) gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.

    Write the code Medium 3 stages int round rounding type conversion
  2. Challenge

    Sensor ID parts

    Split a sensor ID like ENG-2 into its subsystem and its unit number as an int, work out the next ID, then handle subsystems with a dash in their name using rsplit().

    Write the code Medium 2 stages strings split rsplit int
  3. Challenge

    Tank level

    Turn a tank's capacity and contents into a fill percentage with one decimal place, then draw the crew display's ten-segment gauge with string repetition and int().

    Write the code Easy 2 stages percentage division rounding string repetition
  4. Challenge

    Mission config

    …and modify Investigate. Every value has a type: int for whole numbers, float for decimals, str for text and bool for True / False . Replace each ... with the type of that value, for example crew_type…

    Write the code Easy 3 stages variables data types int float