Skip to main content

WizCoin is a module for handling wizard currency.

Project description

A Python module to represent the galleon, sickle, and knut coins of wizard currency.

This module is meant as an education example of Python’s object-oriented design practices.


pip install wizcoin

Quickstart Guide

CoinBag objects hold a number of galleons, sickles, and knuts. There are 29 knuts per sickle, and 17 sickles per galleon. The CoinBag objects represent an amount of coins, not an amount of money. A CoinBag cannot have fractional amounts of coins or negative amounts of coins.

>>> bag = CoinBag(galleons=2, sickles=5, knuts=10)
>>> bag.galleons
>>> bag.sickles
>>> bag.knuts
>>> bag.value
>>> bag.knuts = 20
>>> bag.value
>>> bag.convertToSickles()
>>> str(bag)
>>> bag + bag
CoinBag(galleons=0, sickles=78, knuts=40)
>>> bag += CoinBag(1, 0, 0)
>>> str(bag)
>>> bag.convertToGalleons()
>>> str(bag)
>>> del bag.knuts
>>> str(bag)
>>> list(bag)
['galleon', 'galleon', 'galleon', 'sickle', 'sickle', 'sickle', 'sickle', 'sickle']
>>> bag *= 2
>>> str(bag)
>>> bag2 = CoinBag()
>>> str(bag2)
>>> bag >> bag2
>>> str(bag)
>>> str(bag2)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WizCoin-0.0.1.tar.gz (6.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page