Earth Orbit Simulator
There is no obvious astronomy error, but your use of math.pow is wrong

You write constgrav = math.pow(6.67,-11).  That means $G = 6.67^{-11}$.  You mean constgrav = 6.67e-11 or $G=6.67\times 10^{-11}$.

With completely different initial conditions, it is not surprising that the Earth flies off into space.

As a suggestion, try not using SI units for this, as it makes for some very small and very large intermediate values, the computers have difficulty in rounding.  Instead measure distance in Astronomical Units, Mass in "solar masses" and time in years. You can convert back to SI units when printing or plotting.