Tuesday, 19 September 2017

How to run a basic Python program ?


USING PYTHON for Windows and VSCode editor
1. Install Python (latest version) for Windows
2. Append path of python in PATH variable in environment variables.
    xxxxx;C:\Programs files\Python\Python36-32\;.
3. Install VS Code. Open VS Code.
4. Create your project folder and open it in VS Code.
5. Create a file with extension .py (Example: hello.py)
6. Write the code
print( "Hello " + "World")
 
7. Open the terminal using view > Integrated terminal
8. Go to your project folder
9. Execute the .py file
    > python hello.py

10. It will show result in terminal.


PYTHON SHELL
In order to execute using Interpreter (command by command), you can use Python shell.
1. In terminal, go to your project folder
2. Enter into python shell.
    > python

3. Run the command :
print( "Hello " + "World")


4. It will show result in terminal.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.