To create and execute python programs using visual studio we must first setup a python environment.
Below are the necessary software which needs to be installed on your computer to create your first application in python:
Steps:
- Visit https://www.python.org/downloads/ and download one of the following versions
I recommend going with Python 3.6.x version because 3.6.4 is the latest version which will most likely remain stable while 2.7.x is just released to support legacy code.- While installing python you need to select this option as it is very important and will help us further as we progress
After this click Install Now and let the software install itself
Now open Visual Studio on your pc and then click on Get Tools and features… inside Tools
Now in the feature installation window check and install the following features.
For Visual Studio 2017.
Contains Tools for Data Science.
Provides interactive tools for python application development.
For Visual Studio 2015 and 2013 we need to install the above packages from the visual studio website.
Now let’s create a new python program by adding a new project and selecting the Python Application.
The file structure of our newly created application is shown below:
And write the following code inside our PythonVS17.py file
print(1,2,3) print('GM') print(type('hello')) print(type(3)) print(type(3.2)) a = 15 b = 24 print(a+b)
We can run and execute this code like any other application we run on visual studio preferably by either pressing on start or just starting without debugging.
Type in the above code is used to display the datatype of the value provided.
We get the following output when we run our application.
Syllabus of Data Science training in Mumbai