Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHayden Wilson
2,319 PointsI keep getting errors in the REPL about SyntaxError: invalid syntax on line one with File "<stdin>"
I keep getting errors in the REPL about SyntaxError: invalid syntax on line one with File "<stdin>" in most of the programs I'm writing. I then have to reload the repl etc.
Am I doing something wrong?
Heres one example...
import math
def split_check(total, number_of_people):
cost_per_person = math.ceil(total / number_of_people)
return cost_per_person
amount_due = split_check(89.74, 4)
print("Each person owes ${}.".format(amount_due))"
I'll then type: "python check_please.py" into terminal...
which then returns:
"File "<stdin>", line 1 python check_please.py ^ SyntaxError: invalid syntax"
Help appreciated :D Thanks
1 Answer
Mel Rumsey
Treehouse ModeratorHi there Hayden Wilson
If you are trying to run your file, you will need to run it outside of the python shell. To exit the shell you can type exit()
and then try to run the file using python check_please.py
.
Hopefully that helps!