Python Python Basics Types and Branching Numeric

Stephanie Mansoor
Stephanie Mansoor
150 Points

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
  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 (this may not work if your user doesn't have permissions to run that command) c. Now you can run the script as ./

1 Answer

Steven Parker
Steven Parker
167,904 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.