simulation: have print_range method also return the projectile range

This commit is contained in:
raf 2023-10-08 00:01:32 +03:00
parent 573e072c10
commit 46f3b64a15
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29

View file

@ -115,6 +115,8 @@ class ProjectileSimulation:
plt.show() plt.show()
def print_range(self): def print_range(self):
"""Returns the range of the projectile as a string.""" """Prints and returns the range of the projectile."""
range_projectile = self.x[-1] range_projectile = self.x[-1]
return f"Range of projectile: {range_projectile:.2f} m" range_string = f"Range of projectile: {range_projectile:.2f} m"
print(range_string)
return range_string