+ 1
Multiple keys for the same value?
Is there any way to set up a list of keys such that they all lead to one value without needing to redo each entry? IE: is it possible to make {1:5,2:5,3:5,4:6} into something like {1,2,3:5,4:6}? I've tried both that and using a touple, but the first provides an SyntaxError (obviously) and the second requires you to get the whole touple in order to return its output.
5 Answers
+ 2
You really just have to redo each entry mate.
+ 1
Is there a reason why you can't just access the same key?
+ 1
Yeah, the program I'm writing in question is a solubility checker for salts, and it needs to be able to parse different metals. (IE, it should be able to parse Na and K as both leading to soluable salts, even though the elements are different.)
+ 1
Ah, dang. Well, thank you for helping me!
+ 1
Possibly you could use a for loop to iterate through each key (if sequential) and assign the value you wish.