TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

How to execute python

how to execute python - A simple and easy to learn tutorial on various python topics such as loops, strings, lists, dictionary, tuples, date, time, files, functions, modules, methods and exceptions.

<< Back to HOW

How to execute python

To execute Python code, we can use any approach that are given below.

1) Interactive Mode

Python provides Interactive Shell to execute code immediatly and produce output instantly. To get into this shell, write python in the command prompt and start working with Python.

write python code

Press Enter key and the Command Prompt will appear like:

write python program

Now we can execute our Python commands.

Eg:

execute python in interactive mode

2) Script Mode

Using Script Mode, we can write our Python code in a separate file of any editor in our Operating System.

How to execute python Script Mode

Save it by .py extension.

How to execute python Script Mode 2

Now open Command prompt and execute it by :

Script Mode execute python

NOTE: Path in the command prompt should be location of saved file.where you have saved your file. In the above case file should be saved at desktop.

3) Using IDE (Integrated Development Environment)

We can execute our Python code using a Graphical User Interface (GUI).

All you need to do is:

Click on Start button -> All Programs -> Python -> IDLE(Python GUI)

Python Using IDE

We can use both Interactive as well as Script mode in IDE.

1) Using Interactive mode:

Execute our Python code on the Python prompt and it will display result simultaneously.

Python Using IDE

2) Using Script Mode:

i) Click on Start button -> All Programs -> Python -> IDLE(Python GUI)

ii) Python Shell will be opened. Now click on File -> New Window.

A new Editor will be opened. Write our Python code here.

Python Using IDE

Click on file -> save as

Python Using IDE

Run code by clicking on Run in the Menu bar.

Run -> Run Module

Result will be displayed on a new Python shell as:

Python Using IDE
Next TopicPython Variables




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf