I made a function that can calculate the mass of a planet in python.
from math import pi
from scipy.constants import gravitational_constant as g
def planet_mass(dist, t):
vel = (2 * pi * dist) / t
return (vel**2) * dist / g
But calling the function with some specific parameters gives an error.
>>> planet_mass(149597870700,365.25*24*60*60)
File "<stdin>", line 1
planet_mass(149597870700,365.25*24*60*60)
^
SyntaxError: invalid character in identifier
However, calling the function with other parameters like (10000,100000) seems to work fine.
>>> planet_mass(10000,100000)
59151849549836.72
I am using Sublime text 3 and SublimeREPL to run python. How can I fix this problem?
Cut & paste your code with a less forgiving editor, and you'll see the superfluous character in your call:
planet_mass(<200e>149597870700,365.25*24*60*60)
This is a non-printing character in many rendering paradigms, but shows up clearly in vi
. Just delete that character and you'll be fine.