Code Monkey home page Code Monkey logo

dumbbell_weights's Introduction

Dumbbell Weights

This program helps you figure out which configurations of weights you can use with your dumbbells.

Usage

Execute python3 main.py inventory to save a .json-file that stores information about the available weights you own.

Execute python3 main.py config to get a list of total weight configurations available with your set of weights.

Example

python3 main.py config

possible total weights:
*  2.0 kg
   4.0 kg
*  4.5 kg
   6.0 kg
   6.5 kg
*  7.0 kg
*  8.0 kg
  [...]
  24.0 kg
choose total weight:

An asterix indicates that this weight can be configured at least twice.

After choosing your weight you will be able to select a total weight again until there are no more weights to choose from. Once there are no more weights to choose from you will be presented with the configurations for each dumbbell. You can also enter any non-number to stop the selection process.

selected weights:
[24.0, 18.0, 13.5, 4.0, 4.5]

weight combos:
 4.5 kg: [1.25]
 4.0 kg: [1.0]
13.5 kg: [2.5, 2.0, 1.25]
18.0 kg: [3.0, 2.5, 2.5]
24.0 kg: [5.0, 3.0, 3.0]

Assumptions

  • each empty dumbbell weighs 2 kg
  • there are an infinite number of empty dumbbells
  • symmetry:  
    • configurations are always symmetric: [2.0, 1.0] means that there are 2 kg and 1 kg weights on each side of the dumbbell, which results in a total weight of 8 kg = 2 * (2 + 1) kg + 2 kg (empty dumbbell weight)  
    • this means that it doesn't really make sense to add an odd number for a certain weight when executing the inventory command

dumbbell_weights's People

Contributors

pmlk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.