π 2009-Oct-15 ⬩ βοΈ Ashwin Nanjappa ⬩ π·οΈ conditional expression, python, ternary operator ⬩ π Archive
# Read PEP 308 for this design choice.
# Lots of lines for a simple initialization
alist = []
if solved:
alist = solvedList
else:
alist = problemList
# Conditional expression to achieve the above
alist = solvedList if solved else problemList