Part 1: Get Started with Python


This is a tutorial series which will teach you how to code in Python. We will start with the absolute basics of installation of Python in Windows and Python Tools in Visual Studio. We will then go through basic constructs in Python and write a couple of programs to summarize what we have learned. We will end with an Object Oriented Approach using Python and a specific feature of Python Tools in Visual Studio: Mixed mode C/C++/Python Debugging.

Part 2: Get Started with Python

Part 3: Get started with Python: Functions and File Handling

Part 4: Get started with Python: Object Oriented Approach

Part 5: Get started with Python: Debugging in PTVS

Part 6: Get started with Python: Build your first Django Application in PTVS

Introduction

image

Python is a general purpose, object oriented interpreted language which can be used for a wide array of standalone projects or scripting applications. It is one of the most efficient languages with a broad set of functionality available and the best part: It is easy to learn !

In this Lab1, you will be doing the following:

  • Download and install Python
  • Download and install Visual Studio
  • Download and install Python Tools for Visual Studio
  • Create your first Python Project in 5 clicks: Hello World

Download and Install Python

1. Go to https://www.python.org/download

2. Then click on Python 3.4.1 Windows x86 MSI Installer or Python 3.4.1 Windows X86-64 MSI Installer based on your computer.

image

3. After downloading it, run the .msi file to install Python. Follow the steps and you have Python installed.

image

4. Check if Python is installed correctly

Go to Start, search for Python and run Python Command Line

image

5. Check for Environmental Path variable

a) Windows + x -> Advanced System Setting ->Environmental Variables -> Path Variable -> Edit -> Add “C:\Python34\;C:\Python34\Scripts”

b) Now go to Run-> cmd

c) Type “python” and you should see this:

image

Aha! Now you are done installing Python on your Windows system. Next we will see how to use the Python Tools in Visual Studio.

Download and install Visual Studio

Download and Install Visual Studio 2013. If you have an MSDN membership you can download the appropriate version from there. However if you don't, you can still download Visual Studio 2013 Express from the following site: http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx

NOTE: VS Express is free, and the other versions have a 90 day trial (if you don’t have MSDN)

Install Python Tools for Visual Studio

1. Open your favorite browser

2. Go to https://pytools.codeplex.com/wikipage?title=PTVS%20Installation

image

3. Click on the Run button and install PSVT

image

4. Now you have installed Python Tools for Visual Studio 2013

How to create a Python project in 5 clicks

1. Open Visual Studio

2. Click on Projects-> New Projects

image

3. Select Python on the left pane and Python Application on the right. Give it a proper name, select a location and then click on “OK”.

4. Now you will see the following screen. Press F5 or click the Start button

image

5. If you have done all the steps correctly, you will see the following screen.

image

That’s it. You have successfully run your first Python program.

In this tutorial you have accomplished the following:

  • Installed Python for Windows
  • Installed Visual Studio 2013
  • Installed Python Tools for Visual Studio 2013
  • Run your first Python program:  Hello World

Now that you have set up Python tools and Visual Studio, next lab will cover the basics of Python programming like syntax, loops and other basic constructs. We will learn and build on our learning through programs written in Python.  Hope to see you there!

 

 

 

Comments (0)

Skip to main content