How does the Python conditional operator workaround work?
From what I have read, I found that a built-in ternary operator does not exist (I will be happy to know more about it.). I found the following code as a substitute: def val(): var = float(raw_input("Age:")) status = ("Working","Retired")[var>65] print "You should be:",status I couldn't understand how this code works; can anyone explain me how actually the code is working? I am also interested to know why the ternary operator doesn't exist; any references or links about this will be ore useful. I'm running Python 2.6.4 on Windows Vista. Python has a construct that is sort of like the ternary