Projectile redux
It would be "nice" to be able to also obtain this version of projectile:
import math
v, t, p1 = 5.1, 43.0, 12.89
d = 2.0 * v ** 2.0 * math.sin(t) * math.cos(t) / 9.8 - p1
if (math.fabs(d / p1) < 2.0e-2) :
return "The target was hit."
elif (d < 0.0) :
return "The projectile fell short."
else :
return "The projectile went long."
It is, on purpose, rather hideous. [I didn't take the values from the standard input file, I should probably do that.] Nevertheless, we should be able to set options and write a recipe that produces this. (Though maybe those returns should be prints ?)
Yes, I agree. We should be able to produce a simple "bare bones" version of the program. No separate files. No classes. No functions. Just the requirements in the sequence they are listed (input, calculate, output). Some people might say that this simple program should be written like you have it above. The way we currently do it we make a simple program look much more complex than it has to.
Duplicate of #1999, closing, but as always, feel free to re-open if you feel otherwise.
Actually, this is related to, but different. That asks for unmodular, this asks for straight-line and with extra inlining.