So I'm trying to divide fractions, technically I suppose integers. So, for
instance, when the user inputs a 1 as the numerator and a 2 as the
denominator to get the float 0.5, I want to put the 0.5 as the key in a
dictionary and the 1 and the 2 as the values of the key in a list {0.5: [1,
2]}, hoping to access the 1 and 2 later, but not together. I chose a
dictionary so the keys won't duplicate.

I can't find anything in StackOverflow or Python documentation specifically
about this. They talk about accessing a list or a tuple or a dictionary,
but not when the value is a tuple or list.

 I've tried:
fractions.values([0])
which gives a TypeError: values() takes no arguments (1 given)

I've tried
fractions.values()[0]
which gives a TypeError: 'dict_values' object does not support indexing

Both of these errors sort of make sense to me, but I can't find a way to
access the 1 or the 2 in the dictionary key:value pair {0.5: [1, 2]}

Thank you for your help.

-- 
Roger Lea Scherer
623.255.7719

                  *Strengths:*
   Input, Strategic,
Responsibility,

Learner, Ideation
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to