My method returns an address at the link of a value

Hi,

This is an exercise that is not part of the training on the site, I do not understand why when I want to display the return value of the energy method of my satellite class, I receive an address on the console.

Zoe satellite speed = 40.0m / s.
<bound method Satellite.energie of <__ main . Satellite object at 0x01A5E610 >>
Zoe satellite speed = 70.0m / s.
<bound method Satellite.energie of <
main __. Satellite object at 0x01A5E610 >>

this is my code

class Satellite (object):
    "" "Satellite for instantiating objects simulating satellites
artificial launched into space, around the earth. "" "

    def __init __ (self, name, mass = 100, speed = 0):
        self.name = name
        self.mass = mass
        speed choke = speed

    def impulse (self, force, duration):
        "" "will vary the speed of the satellite." ""

        speed self = speed self + (force * duration) / mass self

    def energy (self):
        "" "will refer to the program calling the kinetic energy value of the satellite" ""
        return_val = self.mass * self.speed ** 2/2
        return return_val

    def display_speed (self):
        "" "will display the name of the satellite and its current speed." ""
        print ("satellite speed {0} = {1} m / s.". format (self.name, self.speed))


s1 = Satellite ('Zoe', mass = 250, speed = 10)
s1.pulse (500, 15)
s1.display_speed ()
print (s1.energy)
s1.pulse (500, 15)
s1.display_speed ()
print (s1.energy)

both .speed() and .energy() are methods, yet you call/invoke speed() correctly while with energy you are only referencing the method

2 Likes