I'm writing the program for a psychology experiment that requires participants to learn a new number pad mapping.
If the keys were letters it would be easy enough:
a=1
, b=2
, c=3
etc.
But apparently Python doesn't allow mapping to integers. Hmm.
A partial solution could be to use a dictionary, such as:
newdict = {'1': 9, '2': 8, '3': 7}
However, participants will be typing into a text box, and when their entry appears in the box it needs to have been converted already. There is no clear way to apply the newdict['1']
call.
How can this remapping be accomplished?