liveBook · Manning

Unit conversion

As explained in Build Python Web Apps with Streamlit

Unit conversion is the calculation of an equivalent quantity expressed in a different unit, usually within or between measurement systems.

Unit conversion calculates an equivalent quantity in another unit. A practical conversion app accepts a numeric quantity, a from-unit, and a compatible to-unit, then displays the result. section 3.3

A useful unit-conversion app should:

  • Prevent incompatible conversions, such as converting pounds to yards. section 3.3
  • Support conversions within imperial or metric systems and across systems. section 3.3
  • Make adding units or quantities straightforward for future maintenance. section 3.3

Scope example

Converting pounds to kilograms fits a simple conversion-factor model. Converting dollars to euros does not: changing exchange rates require current data from an online API, so currency conversion remains outside the initial scope. section 3.3.1

Treat the interface as the frontend: it collects inputs and displays results. Treat the conversion logic as the backend: it processes the input and returns the output. section 3.5

How Build Python Web Apps with Streamlit covers it

How deep it goes
Defines inputs, compatible units, supported systems, and scope, then sketches frontend and backend roles without implementing conversion logic.
Examples
Uses feet-to-inches, meters-to-centimeters, feet-to-meters, pounds-to-kilograms, and dollars-to-euros as contrasting examples.
What you can do after
Build it from scratch by defining conversion requirements, setting scope, and separating user interaction from conversion processing.
How it connects
Connects unit conversion with requirements, scope, measurement systems, frontend design, backend processing, and conversion factors.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.