I need some help understanding why my code doesn’t work.
First off the tasks says:
- The temperature is less than 800 K.
- The number of neutrons emitted per second is greater than 500.
- The product of temperature and neutrons emitted per second is less than 500000.
My code:
if temperature < 800 and neutrons_emitted > 500 and (temperature*neutrons_emitted) < 500000:
return true
else:
return false
Code I got from a right solution
if temperature < 800 and neutrons_emitted > 500:
return (temperature * neutrons_emitted) < 5e5
return False
I don’t understand why mine doesn’t work. For my if statement I’m looking at three conditions. If temp < 800, if emitted > 500, and if the sum of them is less than 500,000. What logic am I doing wrong? Why does the right code work and mine fails?