How to run program in python?
You have to install python before starting to work in it. There are multiple ways and different versions of python available today.
When you are done with the installing process of python you can run your program in the following two ways:-
- in interactive mode(also called Immediate mode)
- in script mode
Working in interactive mode:-
In this type of mode we write one command at a time and it gets interpreted first. Then it gives you the output of that first command.
- Type python in search bar.
- It will open Python shell where we’ll see the Python prompt(three ‘>’ i.e. >>>)
- Type command in front of the python prompt and it will immediately give us the output.
Working in script mode:-
There is one problem in above mode. If we want to write the whole program and then find the output then what will we do?
The solution of the above problem is script mode. In this script mode we can write the whole program at a time and then save it, and we can run it to see the output of the whole program.
- Create module/script/program file.
- Open python prompt then File → New in IDLE python shell.
- In the new window opens, type the commands you want to save in the form of a program.
- Save the program with .py extension.
- Run the program.
Please login to comment
View all comments