Can I conditionally choose what variable I assign a value to?
问题 I know that you can do things like this in Python: var = value1 if( booleanCheck() ) else value2 What I want to know is if I can conditionally choose which var I place a value into with a similar sort of structure? something like this: (var1 if( booleanCheck() ) else var2) = value In my case specifically I'm trying to assign a child node to the correct side in a Binary Search Tree, I know I can just do a normal if block but I was trying to challenge myself to using minimal space. 回答1: Well