Skip to main content

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.

Installation

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
2
>>> bag.sickles
5
>>> bag.knuts
10
>>> bag.value
1141
>>> bag.knuts = 20
>>> bag.value
1151
>>> bag.convertToSickles()
>>> str(bag)
'0g,39s,20k'
>>> bag + bag
CoinBag(galleons=0, sickles=78, knuts=40)
>>> bag += CoinBag(1, 0, 0)
>>> str(bag)
'1g,39s,20k'
>>> bag.convertToGalleons()
>>> str(bag)
'3g,5s,20k'
>>> del bag.knuts
>>> str(bag)
'3g,5s,0k'
>>> list(bag)
['galleon', 'galleon', 'galleon', 'sickle', 'sickle', 'sickle', 'sickle', 'sickle']
>>> bag *= 2
>>> str(bag)
'6g,10s,0k'
>>> bag2 = CoinBag()
>>> str(bag2)
'0g,0s,0k'
>>> bag >> bag2
>>> str(bag)
'0g,0s,0k'
>>> str(bag2)
'6g,10s,0k'

Release files for WizCoin 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for WizCoin 0.0.1
File Size Uploaded
WizCoin-0.0.1.tar.gz 6.7 kB Details

Release files / WizCoin-0.0.1.tar.gz

Download URL WizCoin-0.0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a2d16aa3b49eabcea6754934703541cee6bd7a7db8387a77749e7943f7aabbb
BLAKE2b-256 checksum
How to use checksums
85be9d354b623e86a387b07e9f5f3ae6aaf264399a9104c718dd78c4846833c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page