I can not understand what is wrong in my code | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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....

4th Sep 2017, 9:31 PM
HamtaroTumin
HamtaroTumin - avatar
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 :)
4th Sep 2017, 9:36 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar