Results for “comparison”

Showing 11–18 of 18

  1. Challenge

    Clear error messages

    …and the function stops with a confusing TypeError from the comparison. Check the type first and raise your own TypeError , naming the type that came in: 500.0 Refused: burn length can't be negative…

    Write the code Medium 2 stages errors raise ValueError TypeError
  2. Article Mini projects

    Base 6 Number System in Python

    …which means "one group of six, plus zero ones." Here's a comparison table to make this click. Let's count from 0 to 12 in both systems: Decimal (Base 10) Senary (Base 6) What's happening 0 0 Same in…

  3. Challenge

    Manifest validator

    …Check the type with isinstance(mass, (int, float)) before comparing it. Duplicates and the total load Two things one item can't know about itself: whether its ID was already used, and whether the…

    Write the code Medium 2 stages project validation dictionaries functions
  4. Challenge

    Validate a cargo record

    …problems at the end. Check that "mass_kg" is there before comparing it. The ID format Cargo IDs have a fixed format: CG- followed by exactly four digits. Add bad ID format to the problems when the ID…

    Write the code Medium 2 stages functions return lists validation
  5. Article Python Fundamentals

    Python Functions for Beginners

    …the end. Hint: use .strip().lower() on both answers before comparing them, so "Mars", "mars " and "MARS" all count as correct. This project pulls together almost everything in this article, so take…

  6. Article Python Fundamentals

    Nested Loops in Python

    …2D/3D data - maps, satellite images, coordinate grids Comparing everything with everything - checking distances between all objects Searching nested structures - like checking systems in each vehicle…