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 Types and Branching Numeric

I must have missed this in the last videos but why do we type "python" when we start? Thank you

I must have just missed this part haha!

There's two ways to run a python script on a terminal

  1. You tell python to run a script e.g python some_script.py
  2. You can actually run a script without explicitly typing python, but it's a bit convoluted if you're a beginner (steps below are for mac/linux it may be different for windows) a. on the top of your program say "#!/usr/bin/env python" and save. If your code is version specific say python2 or python3 in that line b. give the script run permissions on terminal: chmod +x some_script.py (this may not work if your user doesn't have permissions to run that command) c. Now you can run the script as ./some_script.py

1 Answer

Steven Parker
Steven Parker
231,269 Points

Typing the command "Python" starts the program running that will interpret and perform program statements written in the Python language. As you suspected, this was covered in the previous video The Python Shell, in case you'd like to review it.