+ 1
I can not understand what is wrong in my code
https://code.sololearn.com/cC96z48ljvcl/?ref=app it says syntax error but I can't understand what is it even....
1 Respuesta
+ 2
You can't compare type and values like that, and you did lots of other simple mistake
here is a correction :
speed = 299792458
squared = speed * speed
print("Tell us the mass in SI unit:")
mass = input()
def energy(mass):
global squared
try:
mass = float(mass)
print("Energy is " + str(mass * squared) + " Joules.")
except:
print("We wanted a number only")
energy(mass) #input is a function, not the input you saved in mass
You should be able to find what you did wrong if you compare both codes :)