The Python interpreter runs the text commands you enter into the Python shell and spits out the appropriate response. This is useful for quickly trying new things out. When you download the latest version of Python, you will be able to open the Python shell and interpreter by using your operating system’s terminal (i.e. command line). On Windows, press Window + R, type cmd, and hit enter to open the terminal. Then, type python and hit enter to run the Python interpreter.
Once you’ve got the Python interpreter (shell) open, you’ll be able to run single statements and get immediate results. For example, you could type the expression 5+5, hit enter, and get the result 10 all within the Python interpreter.
Python Command Line Tools to Know
There are a few useful commands that can help you navigate the Python terminal while you’re trying out simple Python code and possibly Python scripts. Simply type help() and hit enter in the Python interpreter to bring up help functionality. Once you’ve familiarized yourself with what you can do, return to the Python prompt by hitting q.
Need to leave the interactive shell? Press Ctrl-Z and hit enter on Windows. Press Crtl-D and hit enter on Linux and OS X. If you’re not a fan of keyboard shortcuts or you forget these ones, you can always type exit() and hit enter to return to the console.
- Press q to exit the help functionality
- Press Ctrl-Z to exit the Python shell (Windows)
- Press Ctrl-D to exit the Python shell (Linux and OS X)
Learn Python-Centered Software Engineering
If you’re interested in learning more about Python and how to use it for software engineering, then check out Hackbright’s 5-week Prep course. You’ll learn fundamentals of programming and Python, including best practices for the Python shell, interpreter, and scripts.
- Admissions Office (28)
- Adora Cheung (5)
- Alum (98)
- Blog (166)
- Career Services (26)
- Diversity (18)
- Engineering Advice (67)
- Hackbright Field Trips (24)
- Hackbright Mentors (21)
- Hackbright News (109)
- Homejoy (5)
- Podcast (2)
- Profiles of Woman Engineers (110)
- Recruiting & Hiring (16)
- Resources (47)
- Student Blogs (24)
- Tech (54)
- Thought Piece (23)
- Uncategorized (61)
- Video (20)