Previous Tutorial: Python Introduction (Part 1)
Python Introduction
Let’s continue with Python introduction tutorial. In the previous tutorial, we learned about Python’s definition, history, and versions. In this tutorial, we will learn about Python syntax. We are also going to learn how to work with Python in IDLE, CMD, and Notepad. So first, start with, what is Python syntax?
Python Syntax
Syntax is necessary for Python programming. Syntax are basic rules for writing Python code. For example, if we want to print some text on output, we use print()
function.
print('Hello World!')
print('I am learning Python programming')
Hello World!
I am learning Python programming
Now here we used print()
function, so first we write print
, then we use parentheses (). Between the parentheses we write, Hello World!
This was our text, which we want in the output. We also surrounded our text with single quotes ('Hello World!')
. So this is a syntax, or we can say this is a rule: we have to write our code according to this syntax. For example, if we did not use quotes with text.
print(Hello World!)
SyntaxError: invalid syntax. Perhaps you forgot a comma?
We get SyntaxError in the output because we didn’t follow the correct syntax to write Python code. In Python, text is considered a string data type. And when we write strings, we have to use the quotes. So this is syntax: if you are writing a string, you have to surround that string with quotes.
print(40478)
40478
Here we print a number on the output, but we didn’t use any quotes, and still we get the output without any error. Because this time we are printing an integer number, which is considered as ‘int’ data type in Python. And we can use numbers without using any quotes. So this is another syntax. However, if we try to print this number without parentheses:
print(40478
SyntaxError: '(' was never closed
We get SyntaxError because parentheses are mandatory while printing. So this is another syntax.
Python is a case-sensitive language. It means uppercase and lowercase letters are treated differently. For example:
text1 = 'Python'
text2 = 'Programming'
print(text1)
print(text2)
Python
Programming
Here we created two variables named text1
and text2
. Then we used the print function to print the value of those variables. We can see between the parentheses we write the exact same variable name. If we write variable names like this:
text1 = 'Python'
text2 = 'Programming'
print(text1)
print(Text2)
Python
NameError: name 'Text2' is not defined.
We get "Python"
as the first output, but for the second output, we get an error. Because in 4th line of code, we write print(Text2)
, but we created variable name with text2
, So in Python, T and t have different meanings. So text2
and Text2
are both different.
Python has lots of syntax; we’ll learn about them as we learn Python.
Work With Python in CMD Or PowerShell
After the installation of Python, we can do some basic coding in CMD. Open CMD or PowerShell. If we want to check the Python version. Simply type the below code in CMD and press Enter.
Python --version
Python 3.13.4
In the output, we get the information about Python version that is installed in your system. We can do some basic coding in CMD. For example, first type “Python” and then press enter. Then we can use the print() function, type the below code, and press enter.
print('Hello World!')
Hello World!
We can do some other coding like:
>>>print('Hello')
>>> 4 + 4
>>>print('Python' * 3)
>>> print('Hello')
Hello
>>> 4 + 4
8
>>> print('Python' * 3)
PythonPythonPython
>>>
Python syntax is the same here if we write like this:
print(Hello)
NameError: name 'Hello' is not defined
We didn’t surround text with quotes, so we get an error. We can write code in CMD, but IDEs provide more features and a more convenient way to write code.
Work With Python in IDLE
Every Python installation comes with an integrated development and learning environment, which you’ll see shortened to IDLE or even IDE.
Python IDLE comes included in Python installation on Windows. We can use Python IDLE as an interactive interpreter or as a file editor. Python IDLE is only text-based and does not consist of a graphical user interface.
To open IDLE, just type IDLE
in the search bar in your Windows. It will open the IDLE shell. By default, when it starts, it shows the version of Python installed on your device.

So this is the default screen of IDLE. It shows the version of Python; in our case, it’s Python 3.13.5
We can write code in IDLE, the same as we write code in CMD.

We can create a new Python file, Click on File
then click on New File
this will open a new blank window. Here you can write your Python code and then save this file. It will automatically add the .py extension. py is the extension of Python files. In the same way, we can open any saved file. Click on file
, then click on, open
then select your file location.
When you open your file, in the right corner, there are two options, like Ln:9 Col:0, It means
- Ln = Ln shows the line number that your cursor is on.
- Col = Col shows the column number that your cursor is on.
You can restart your IDLE shell by clicking on Shell from the menu and then clicking on Restart Shell. Now it will work as a fresh IDLE.
You can learn more about IDLE from Python official website.
Writing Python Code in Notepad
Now we have seen we can write Python code in CMD and in IDLE. If we want, we can write our Python code in Notepad.
Just open Notepad. Write your code. For example, we simply write print('Hello Python')
and save this file. Provide a file name; when writing your file name, add py
at the end of the file name to make this a Python file. Like, we save our file anotherdaywithpython.py
To open Notepad, type “notepad” on Windows, and it will open Notepad. Write your code:

Save this file by providing any name, but at the end of the file name, add .py as Python extension.

Now our file is saved. We can open this file with any IDE.
Conclusion
This is the end of Python Introduction (Part 2) tutorial. In this tutorial, we learned about Python syntax. We also learn how to write Python code in CMD, in IDLE, and in Notepad.
Next Tutorial: Python Introduction (Part 3)


3 thoughts on “Python Introduction (Part 2): What is Python IDLE and Python Syntax?”