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.

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'

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 details)

Uploaded Source

File details

Details for the file WizCoin-0.0.1.tar.gz.

File metadata

  • Download URL: WizCoin-0.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for WizCoin-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7a2d16aa3b49eabcea6754934703541cee6bd7a7db8387a77749e7943f7aabbb
MD5 3d700d23efede1e7b5e36931d0992ff6
BLAKE2b-256 85be9d354b623e86a387b07e9f5f3ae6aaf264399a9104c718dd78c4846833c3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page