Showing posts with label Python Interactive. Show all posts
Showing posts with label Python Interactive. Show all posts

Thursday, May 31, 2018

How does For..Break work in Python?

For loops through and at the first instance of a conditional match, it breaks and exits the loop.

Here is an example for a list in Python.


PythonFor_Break_0

The first two items in the list does not satisfy the condition and therefore you have two responses and when the program encounters 2 which is divisible by 2 (it's using modulo) the condition is satisified and it prints and then exits.

Here is the same in Visual Studio's Python interactive.


PythonFor_Break_1

Tuesday, May 8, 2018

How do you use Interactive Python in Visual Studio 2017 Community?

Visual Studio provides access to Interactive C#, Python and F#. We have already seen how to use C# interacitve in visual Studio.

Herein, we will start Python Interactive in Visual Studio 2017 Community IDE.

Launch Visual Studio 2017 Community from All Programs (look under V).


PythonInterA_0.png


Click Start and in the start Window click View | Other Windows as shown. You will see all interactive programs that you can use in Visual Studio.


PythonInterA_1.png

Click Python Interactive. Python 3.7 (x32) opens as shown.


PythonInterA_2.png

Enter some simple calculation to start with and note that intellisense-type feature is available as long as the DB is current.

PythonInterA_3.png


You can see the result as shown.

PythonInterA_4.png

$help command opens the help file and keyboard shortcuts as shown.



PythonInterA_5.png
That is all...