Results for “type conversion”

Showing 11–17 of 17

  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. Article Mini projects

    Converting Temperatures in Python

    …In this article, we'll show you how to make such conversions easily using Python. To perform the conversion, we need to know the formulas for converting degrees Celsius to Kelvin and degrees…

  3. Challenge

    Safe number input

    The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…

    Write the code Easy 2 stages errors try except ValueError
  4. Article Python Fundamentals

    Numbers and Basic Math Operations in Python

    …through space exploration examples. Learn about number types, operators, and practical applications that will help you start your programming journey in an engaging way.

  5. Article Python Fundamentals

    Python Functions for Beginners

    …Every example below runs as it is. Open the editor and type along rather than just reading. Typing the code yourself sticks far better, and you'll make a few typos that teach you more than the article…