[Tutor] using conditional expression
dn
PyTutor at DancesWithMice.info
Thu Oct 8 16:53:35 EDT 2020
On 09/10/2020 08:22, Manprit Singh wrote:
> Dear sir ,
> Let us consider a problem where i have to make a new list of all even
...
> Just need to check if this can be written as given below or not :
What happened when you wrote it that way and ran the program?
> Third alternative way is :
Can you solve the problem all on one line?
Can you solve the problem with a single loop rather than multiple
compound statements?
> Which way should be preferred to solve this kind of problem ?
> need your comments
How might the answer depend upon the level of competence - of you, your
colleagues, and/or future coders who may be expected to maintain this code?
What are your arguments for code-brevity and the exertion of powerful
coding-constructs (and inevitably, increased complexity)?
What might be the arguments for eschewing comprehensions and the like,
in favor of 'straight-line', if longer, code blocks?
--
Regards =dn
More information about the Tutor
mailing list