Click For Python Introduction Part 1
Python Syntax
Continue the Python introduction tutorial. 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.
Code:
print('Hello Python')
Output:
Hello Python
Now here we used print()
function, so first we write print
, then between the parenthesis we write. Hello Python This was our text, which we want in output. We also use quotes(' ')
when we write Hello Python.
Now Hello Python is a simple text that we want to print; we can use another text for print. For example:
Code:
print('Hello Python, I am learning Python programming.')
Output:
Hello Python, I am learning Python programming.
Now what if we write our text without quotes? For example:
Code:
print(Hello Python, I am learning Python programming.)
Output:
SyntaxError: invalid syntax. Perhaps you forgot a comma?
We get SyntaxError, because we didn’t use our text with quotes. Quotes are required when we write text. So this is what syntax is. These are the mandatory rules that we should follow. For example, if we didn’t use parenthesis or use only one parenthesis.
Code:
print'Hello Python, I am learning Python programming.'
print('Hello Python, I am learning Python programming.'
Both statements will give us SyntaxError. So this is the syntax in Python. This is the basic syntax for printing strings in Python. There are lots of other syntaxes in Python. Click on the below topic to learn their syntax and more information.
Click for Python Quotes Tutorial
Click for Python Indentation Tutorial
Work With Python in CMD Or in PowerShell
When we installed Python. We can do some basic coding in CMD. Open CMD or PowerShell. If we want to check the Python version. Simply type in CMD the below code and press Enter.
Code:
Python --version
Output:
Python 3.13.1
We get the version of Python. We can do simple coding in CMD too. First type Python and press Enter. Now we can write print for output.
Code:
>>>print('Hello')
>>> 4 + 4
>>>print('Python' * 3)
Output:
>>> print('Hello')
Hello
>>> 4 + 4
8
>>> print('Python' * 3)
PythonPythonPython
>>>
Syntax is the same here too. If we write our code like this:
Code:
print(Python)
Output:
NameError: name 'Python' is not defined
We can do the Python coding in CMD too, but IDE provides more features and a 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 on search in your windows. It will open the IDLE shell. By default, when it starts, it shows the version of Python installed in your device. In our case, it’s Python 3.13.1
We can write our code, just like we did 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 py extension. py is the extension of Python files.
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
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, click on Shell from the menu, then click on restart shell. Now it will work as a fresh IDLE.
So these are some basics of Python IDLE.
Working With Python in Notepad
Now we have seen we can write Python code in CMD, in PyCharm, 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
Now we can open this file in any IDE.
Conclusion
This is the end of the Python programming tutorial. This is the basic introduction to Python programming. Click on the below link to continue the next Python tutorial.
End of Python Introduction Tutorial
One thought on “Python Introduction (Part 2): Python Syntax and What is Python IDLE? Python in CMD.”