I'm new to python and working on some homework.
didn't work.
Is there easy way to do that?
Thanks,
def letter(i): switcher={ 0:'a', 1:'b', 2:'c' } return switcher.get(i,"Invalid")
Output:letter(0) -> 'a'
letter(2) -> 'c'
letter(3) -> 'Invalid'
Can I use a range in the case#? something like below, I tried different ways but didn't work.0:'a', 1:'b', 2..5:'c'I also tried
range(2,5):'c'
didn't work.
Is there easy way to do that?
Thanks,