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 trialmiguel hernandez
Courses Plus Student 732 Pointsi don't know how to make run
I'm having a hard time trying to click run, or make the program run. he mentions to press up in the console but its not working for me
2 Answers
Amy Murphy
6,172 PointsTo run a script in the console, type python filename.py or python3 filename.py.
For example, if I wrote a script and called it add.py, I would run it by typing the following into the console:
python add.py
or
python3 add.py
Pressing the up key in the console gives you the last line you entered there, which wouldn't work if you've just launched the console, as you haven't entered anything yet.
Hope this helps!
Fatin Farisyah
Front End Web Development Techdegree Student 3,220 PointsSo everytime we add new lines of code, we need to type in -python filename?
Melissa Ho
1,600 Pointsyes, python <filename>.py helps to recompile the new python script to be run within the terminal/console
chaou youva
3,647 Pointschaou youva
3,647 PointsHey, to run a python file on the console, you need to enter the keyword 'python' followed by the name of your file for example: python my_file.py and then your code is going to run I hope it was helpful