

As of yet, nothing has been done to pause the program while it's running, it will just print a wave pattern for a few iterations. This command runs the code in the debugger.

St = ' ' * numspaces + 'o' # place 'o' after the spacesĬheck that the code works properly by pressing F5 or selecting the Debug > Start Debugging menu command. Numspaces = int(20 * cos(rad) + 20) # scale to 0-40 spaces Rad = radians(x) # cos works with radians # Create a string with spaces proportional to a cosine of x in degrees It also places the for loop into a main function and runs it explicitly by calling that function: from math import cos, radians This variation of the code expands make_dot_string so that you can examine its discrete steps in the debugger. Replace the code in the PythonApplication1.py file with the following code. Such actions are essential for tracking down program bugs, and also provide helpful aids for following the exact program flow. At any point when the program is paused in the debugger, you can examine the entire program state and change the value of variables. You can also pause the program whenever certain conditions are true.

In the debugger, you can run your code step by step, including every iteration of a loop. Visual Studio provides capabilities to manage projects, a rich editing experience, the Interactive window, and full-featured debugging for Python code. Previous step: Use the Interactive REPL window
#VISUAL STUDIO CODE PYTHON DEBUG STEP BY STEP FOR MAC#
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
