Skip to main content

Generate lists and dictionaries with fruit names and random pricing data for demonstrating fundamentals in Python.

Project description

Fruit Stand

v1.0.3

Fruit Stand generates lists or dictionaries of fruits to streamline to demonstration of Python fundumentals involving the two data types.

Installation

pip install fruit_stand

Usage

import fruit_stand

Fruit Stand contains four functions:

  1. all_fruits()

    This returns a list of all the fruits that Fruit Stand has.

  2. shopping_list(n = 10)

    Returns a list of n fruit names.

  3. fruit_prices(n = 10)

    Returns a dictionary containing n number of fruits as keys and random float values between 0.0 and 1.0 representing their price.

  4. fill_basket(n = 10)

    Returns a dictionary containing n number of fruits with dictionaries as values. These nested dictionaries contain:

    • quantity - Random integer value between 1 and 10 representing how many of this item are in the basket
    • price_per - A random float value between 0.0 and 1.0 representing the price per item.
    • item_total - The product of multiplying quantity by price_per

If no value for n is passed to these functions, they will return 10 items each by default.

If anything other than an integer is passed to these functions, a TypeError will be raised, and None will be returned.

Project details


Download files

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

Files for fruit-stand, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size fruit_stand-1.0.3-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size fruit_stand-1.0.3.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page