[Solved] Trying to change or interpret the C code to python

[ad_1]

So the thing is, Python does not have the same ternary operator.

condition?true:false => true if condition else false

To implement the line:

return(isalpha(ch) ? accvs[ch & 30] : 20)

in python, you have to do the following:

return (accvs[ord(ch) & 30] if ch.isalpha() else '20')

[ad_2]

solved Trying to change or interpret the C code to python