Answer:
# input values from user
mass = float(input("Please enter the mass in kilograms: "))
velocity_of_light = 299792458 # in meters per second
# calculate energy
energy = mass * velocity_of_light ** 2
# output result
print(f"The energy equivalent of a mass of {mass:.2f} kg is {energy:.2f} joules.")
Step-by-step explanation:
In the code above, the user is prompted to enter the mass in kilograms using the input() function. The code then calculates the energy equivalent to the mass using a predetermined speed of light and prints the result to the screen using the print() function. This code is efficient in calculations because it uses the exponential operator ** and the float numeric data type.