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

General Discussion

How can you save a python program, in a code editor/compiler, and make it executable?

When you create a function, using: def body (): return How can you compile the program

2 Answers

Steven Parker
Steven Parker
231,248 Points

Python code doesn't need to be compiled. You can execute it just by naming the program when you start up Python. For example, you would enter something like this to the command prompt:

python myprogram.py

(This question should probably be posted to the "Python" topic area.)

Thank you! There are a couple of things that still bug me, though. Whenever I try opening my python code outside of a code editor(like notepad or notepad ++), it doesn't open up. How would I open it up like I'm opening a program or a game app? Secondly, how will I access the the console when I'm assessing when I run the program? The second question deals with running the program, (obviously once a variable is used, and a function is called),checking to see if a player/user can interact with the code.

Steven Parker
Steven Parker
231,248 Points

I thought I already answered the first question. Isn't "opening a program" and "executing" the same thing? If not, perhaps you could explain in a bit more detail.

And user interaction, both input from and output to the console, is covered in the Python courses from the very beginning. Which courses have you taken so far?