How to run python program.

Thonny IDE

You can run your python program using Thonny IDE.

download Thonny IDE Download
  • Download Thonny IDE.
  • Run the installer to install Thonny on your computer.
  • Go to: File > New. Then save the file with .py extension. For example, hello.py, example.py, etc.
  • You can give any name to the file. However, the file name should end with .py
  • Write Python code in the file and save it.
  • Run Python on your computer
  • Running Python using Thonny IDE
  • Then Go to Run > Run current script or simply click F5 to run it.

  • Run Python Program in Visual Studio code editor

    install VS Code
    install the Python extension for VS Code from the Visual Studio Marketplace.
    The Python extension is named Python

    create project folder python_programs

    open python_programs folder in your visual studio code editor.

    select the New File button on the python_programs folder create a new file test.py in python_programs folder.

    print("Hello mahi")

    msg = "Hello World" print(msg)

    Save file test.py

    Run Program

    It's simple to run test.py with Python. Just click the Run Python File in Terminal play button in the top-right side of the editor.

    There are three other ways you can run Python code within VS Code:

    1. Right-click anywhere in the editor window and select Run Python File in Terminal (which saves the file automatically):

    2. Select one or more lines, then press Shift+Enter or right-click and select Run Selection/Line in Python Terminal. This command is convenient for testing just a part of a file.

    3. From the Command Palette (Ctrl+Shift+P), select the Python: Start REPL command to open a REPL terminal for the currently selected Python interpreter. In the REPL, you can then enter and run lines of code one at a time.

    How to Run Python program on console

    C:\python_pro> python test.py

    Run program

    File Name : test.py

    C:\python_pro> python -u "c:\python_pro\test.py"

    Run program

    File Name : test.py

    C:\python_pro> python -u test.py

    Write a program to test given no is even or odd.

    File Name :

    num = int(input("Enter a number: "))
    if (num % 2) == 0:
    print("{0} is Even".format(num))
    else:
    print("{0} is Odd".format(num))

    Run program

    File Name : even_odd.py

    C:\python_pro> python -u even_odd.py





    Previous Next


    Trending Tutorials




    Review & Rating

    0.0 / 5

    0 Review

    5
    (0)

    4
    (0)

    3
    (0)

    2
    (0)

    1
    (0)

    Write Review Here