Tell us what’s happening:
The console just says there is an issue in your code but the preview isn’t showing any error. So am I doing wrong here
Your code so far
import math
GRAVITATIONAL_ACCELERATION = 9.81
PROJECTILE = "∙"
x_axis_tick = "T"
y_axis_tick = "⊣"
class Projectile:
__slots__ = ('__speed', '__height', '__angle')
def __init__(self, speed, height, angle):
self.__speed = speed
self.__height = height
self.__angle = math.radians(angle)
# User Editable Region
def __calculate_displacement(self):
v=self.speed
a=self.angle
g=GRAVITATIONAL_ACCELERATION
h=self.height
return (v * math.cos(a) * (v * math.sin(a) + math.sqrt(v**2 * math.sin(a)**2 + 2 * g * h))) / g
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Learn Encapsulation by Building a Projectile Trajectory Calculator - Step 4