The goal of this project is to expand the functionality of the Python 3.x standard library Fraction class to accept anything that Fraction would and more: Mixed('3 4/5') == Mixed(3,4,5) == Mixed(Fraction(19,5)) etc (see examples section in the source for full list). This class is designed to behave exactly as a standard Fraction would except that 1) it supports string constructions of mixed number fractions, 2) it supports three argument construction in the form of whole_number,numerator, denominator, and 3) the string representation is formatted in mixed number form. All the methods and properties behave the same (except as noted above) with the addition of a fnumerator property which returns the numerator of the fractional portion of the number only and the addition of a whole property which behaves as a % 1 to return only the whole number portion of the number. Why? I wanted it. Python didn't have it. So I wrote it.

Project Activity

See All Activity >

Follow Python Mixed Fractions Class

Python Mixed Fractions Class Web Site

Other Useful Business Software
Auth for GenAI | Auth0 Icon
Auth for GenAI | Auth0

Enable AI agents to securely access tools, workflows, and data with fine-grained control and just a few lines of code.

Easily implement secure login experiences for AI Agents - from interactive chatbots to background workers with Auth0. Auth for GenAI is now available in Developer Preview
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Python Mixed Fractions Class!

Additional Project Details

Registered

2013-11-16