Python Getting Started
Python Getting Started
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
ADVERTISEMENT
Python Install
Many PCs and Macs will have python already installed.
To check if you have python installed on a Windows PC, search in the start bar for
Python or run the following on the Command Line (cmd.exe):
To check if you have python installed on a Linux or Mac, then on linux open the
command line or on Mac open the Terminal and type:
python --version
If you find that you do not have Python installed on your computer, then you can
download it for free from the following website: https://www.python.org/
Python Quickstart
https://www.w3schools.com/python/python_getstarted.asp 1/9
3/28/25, 4:13 PM Python Getting Started
Let's write our first Python file, called helloworld.py, which can be done in any text
editor.
helloworld.py
print("Hello, World!")
Simple as that. Save your file. Open your command line, navigate to the directory where
you saved your file, and run:
Hello, World!
Congratulations, you have written and executed your first Python program.
ADVERTISEMENT
https://www.w3schools.com/python/python_getstarted.asp 2/9
3/28/25, 4:13 PM Python Getting Started
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
ADVERTISEMENT
We have an online Python editor where you can execute your own Python code and see
the result:
print("Hello, World!")
Try it Yourself »
This editor will be used in the entire tutorial to demonstrate the different aspects of
Python.
Python Version
To check the Python version of the editor, you can find it by importing the sys module:
Example
Check the Python version of the editor:
import sys
print(sys.version)
Try it Yourself »
https://www.w3schools.com/python/python_getstarted.asp 3/9
3/28/25, 4:13 PM Python Getting Started
You will learn more about importing modules in our Python Modules chapter.
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
The Python Command Line
ADVERTISEMENT
To test a short amount of code in python sometimes it is quickest and easiest not to
write the code in a file. This is made possible because Python can be run as a command
line itself.
C:\Users\Your Name>python
Or, if the "python" command did not work, you can try "py":
C:\Users\Your Name>py
From there you can write any python, including our hello world example from earlier in
the tutorial:
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
https://www.w3schools.com/python/python_getstarted.asp 4/9
3/28/25, 4:13 PM Python Getting Started
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
WheneverADVERTISEMENT
you are done in the python command line, you can simply type the following
to quit the python command line interface:
exit()
❮ Previous Next ❯
https://www.w3schools.com/python/python_getstarted.asp 5/9
3/28/25, 4:13 PM Python Getting Started
HTML
CSS Track your
JAVASCRIPT SQL progress
PYTHON - it's free!PHP
JAVA HOWUp
Sign TO W3.CSS
Log in C
ADVERTISEMENT
ADVERTISEMENT
https://www.w3schools.com/python/python_getstarted.asp 6/9
3/28/25, 4:13 PM Python Getting Started
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
ADVERTISEMENT
COLOR PICKER
ADVERTISEMENT
ADVERTISEMENT
https://www.w3schools.com/python/python_getstarted.asp 7/9
3/28/25, 4:13 PM Python Getting Started
HTML
CSS
JAVASCRIPT
PLUS
SQL PYTHON
SPACES
JAVA PHP HOW TO W3.CSS C
ADVERTISEMENT
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference
https://www.w3schools.com/python/python_getstarted.asp 8/9
3/28/25, 4:13 PM Python Getting Started
XML Examples C# Certificate
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
ADVERTISEMENT
Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.
https://www.w3schools.com/python/python_getstarted.asp 9/9