(April 23, 2016 at 11:42 pm)SteelCurtain Wrote:(April 23, 2016 at 11:40 pm)Tiberius Wrote: What was her reasoning for making the code so efficient? I mean, it's great to write efficient code, but that's usually something you do in advanced programming classes rather than a discrete math class.
She's the department head. Preparation, I guess.
Honestly, it seems to me like she was just trying to be difficult. Like Cthulhu said, there's no point in optimizing that code. Using if statements are just as valid a way of writing it, and in fact might be the more preferable way of writing it since it's more obvious to people what the code does.