CodesJava

Easy learning with example program codes

Execute Python


Execute Python:

Python codes can be executed in three ways:

Script Mode:

Writing Python code in a text editor and saving it with a .py extension. This file can then be executed in the Command Prompt.

Interactive Mode:

Writing Python code in a Python interactive shell. This method is useful for immediate testing of code with no stress of writing and saving the code in a file. This method is suitable only for testing purpose and for small codes.

IDE Mode:

Writing Python code in an Integrated Development Environment or IDE, such as Thonny, Pycharm, Netbeans or Eclipse. This method is suitable for managing large numbers of Python files simultaneously.

 

Example 1: Printing “HELLO WORLD” in python using Script Mode.

//pythonexample.py

print “HELLO WORLD”

Output:

Example 2: Printing “HELLO WORLD” in python using Interactive Mode.

Example 3: Printing “HELLO WORLD” in python using Interactive Mode and using a Variable.

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki