lookup-tables

Dictionary with multiple keys mapping to same value

Dictionary with multiple keys mapping to same value Question: I have a need to take an integer value and index into a table of corresponding strings. In this case, contiguous ranges of integers should all map to the same string. Something like (with a non-working dictionary example): int_dict = { 0 : “String1”, 1 : …

Total answers: 5