Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to I work with objects with multiple attributes? #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joereddington opened this issue Jun 30, 2021 · 0 comments
Open

How to I work with objects with multiple attributes? #64

joereddington opened this issue Jun 30, 2021 · 0 comments

Comments

@joereddington
Copy link

Struggling to get my head around this.

I have six ingredients:

  • Water
  • Paprika
  • Coriander
  • Turmeric
  • Cumin
  • Rapeseed oil

They each have different percentages of total fat, and saturated fat. I want the amounts of each so that the total fat adds to 22.3 and the saturated fat adds to 1.9, but the overall weight adds to 100. This is easy to do for any one dimension, but I can't work out how to do it for two dimensions at once.

Anyone want to give me a clue?

FWIW, here are the values:

tot_fat['water']=0
tot_fat['paprika']=13
tot_fat['coriander']=0.5
tot_fat['turmeric']=10
tot_fat['cumin']=22
tot_fat['fennel']=0.2
tot_fat['cloves']=0
tot_fat['rapeseed_oil']=100
tot_fat['salt']=0
tot_fat['maize_flour']=0
tot_fat['acetic_acid']=0
tot_fat['citric_acid']=0
tot_fat['tamarind']=0
tot_fat['garlic_powder']=0
sat_fat={}
sat_fat['water']=0
sat_fat['paprika']=2.1
sat_fat['coriander']=0.52
sat_fat['turmeric']=3.1
sat_fat['cumin']=1.5
sat_fat['fennel']=0
sat_fat['cloves']=0
sat_fat['rapeseed_oil']=8
sat_fat['salt']=0
sat_fat['maize_flour']=0
sat_fat['acetic_acid']=0
sat_fat['citric_acid']=0
sat_fat['tamarind']=0
sat_fat['garlic_powder']=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant