Content deleted Content added
m →Python implementation: compressed Python implementation to demonstrate how the concepts may be translated to a single expression in Python |
|||
Line 82:
else:
print(i, y)
</syntaxhighlight>
Utilising recent additions to Python, it is possible to transform the whole program into a single expression.
<syntaxhighlight lang="python">
(math := __import__('math'), f := lambda t: math.sqrt(abs(t)) + 5 * t ** 3, print('\n'.join(f"{i} {'TOO LARGE' if (y := f(t)) > 400 else y}" for (i, t) in reversed(list(enumerate([float(input()) for _ in range(11)]))))))
</syntaxhighlight>
|