I have no idea about how to tackle many if/else statements in python.
Here is my dictionary object which is shown below. There are nearly 30 values containing characters and strings in the dict object.
{
'a': 0,
'b': 1,
'c': 2,
'd': 3,
'e': 4,
'f': 5,
'g': 6,
'h': 7,
...
'aba': 7,
...
}
When I input the key value of the dictionary, it returns its value.
key= input('Enter object key : ')
answer= getValue(key)
How can I define a getValue() method?
Aucun commentaire:
Enregistrer un commentaire