Python def marked as invalid syntax
If the syntax error is indicating the def
it means that def
is not valid at this point in the program. def
starts a statement, so the conclusion would be that you are not starting a statement at the beginning of the line, you must have unclosed parentheses in the previous non-blank, non-comment line.
That is assuming your description is accurate: if not you could get other errors such as an indentation error, or if it indicated somewhere later in the line it could be some other issue you failed to copy exactly.
ei1
I'm a young programmer that makes games and software in Unity My website is ei1.xyz I have 2 apps on the Google play store, Hover Cake and Calculator
Updated on June 04, 2022Comments
-
ei1 almost 2 years
Im working on a (in-shell) geometry calculator in Python, and I get a syntax error everytime marked as the def in the below code:
def scepm(r,h):#surface-area circular-prism(cylinder)comment s.o.f. only print(3.14159265358979323846264338327950*r**2+3.14159265358979323846264338327950*r*h)
It might be something obvious. If it is, can someone please point it out? thanks
-
ei1 almost 10 yearsi call the function in the shell. the shell is where the actual calculator is.