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 trial

Python Python Basics Meet Python Variables

i 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

chaou youva
chaou youva
3,647 Points

Hey, 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

2 Answers

To 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!

So everytime we add new lines of code, we need to type in -python filename?

Melissa Ho
Melissa Ho
1,600 Points

yes, python <filename>.py helps to recompile the new python script to be run within the terminal/console