In the last post we installed
Python 3.11. Let's write our
first program in Python.
Using IDLE Shell
IDLE is Python’s Integrated Development and Learning Environment. The Python
IDLE is an excellent place to experiment with small code snippets. Let's get
started with Python IDLE.
Open the Command Prompt, type Python and hit enter. You should see Python interactive shell.
In the interactive shell type below one liner code and hit enter, you should see output printed in command prompt.
import sys; print(dir(sys))
Using Python File
In the previous section we used Python IDLE shell to write short code snippets, in this section we will learn how to write Python programs using files.
Create new file with name first_program.py in the current directory and write
below code in it.
Save the file, open the Command Prompt in current directory. To run the python file type below command and hit enter.