Write a function to accept a vector of masses (m) from the user and gives the corresponding energy to them. Energy vector is the output of the program. Constant c is the speed of light which is 2.9979 x 108 m/s inside the function.

Respuesta :

Answer:

Written in Python

def energyvector(mass):

    c = 2.9979 * 10**8

    energy = mass * c ** 2

    print(round(energy,2))

Explanation:

This line defines the function

def energyvector(mass):

This line initializes the speed of light

    c = 2.9979 * 10**8

This line calculates the corresponding energy

    energy = mass * c ** 2

This line prints the calculated energy

    print(round(energy,2))