17 lines
328 B
Python
17 lines
328 B
Python
c = 300000000
|
|
|
|
|
|
def compute_energy():
|
|
mass = None
|
|
while not isinstance(mass, int):
|
|
input_string = input("Enter a mass:\t\t")
|
|
try:
|
|
mass = int(input_string)
|
|
except (ValueError, TypeError):
|
|
mass = None
|
|
print(mass*(c**2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
compute_energy()
|