Python Getting Started

 Python Install

To confirm if you have python installed on a Windows PC, look for Python from the start bar or check from the Command prompt (cmd.exe):

To check if you have python installed on your windows, Linux Type

C:\Users\Your Name>python --version

python --version

If python is not installed on your computer, you can download it for free from the following website: https://www.python.org/

Python Quick start

Python is an interpreted programming language, it can be typed using any of text editors and then place those files into python interpreter to be executed.  The files must have and extension .py before it can be place on python.

Where "hello.py" is the name of your python file.

Let's write our first Python file we can use notepad text editor to and save it as.

hello.py

 

 

The way to run a python file is like this on the command line:

Open your command line, navigate to the directory where you saved your file, and run:

Run example »

The output should read:



Congratulations for written and running your first Python program.

The Python Command Line

Python has a command line to test a short amount of code in python. At times it is faster and easiest to time code on the python command line without typing it in file.

To access python command line from the command prompt  type

Python

Type the following on the Windows, Mac or Linux command line

From python prompt type “Hello My Name is Stephen  for example:

 


Which will write “Hello My Name is Stephen” in the command line:

To exit python command line environment, type the following to quit the python command line interface:

exit()

 






Stephen Olubanji Akinpelu

Previous Post Next Post