mirror of
https://github.com/NotAShelf/projectile-simulation.git
synced 2024-11-22 13:20:47 +00:00
simulation: have print_range
method also return the projectile range
This commit is contained in:
parent
573e072c10
commit
46f3b64a15
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue