To send us your message, you need to log in first.
Print
Python is one of the most popular programming languages, with millions of computer programs written in it. Below you can see a simple Python program. To see its functionality, press the Run button.
Copied!
With the print command, you can print a text. In the section below, you can change the text inside the parentheses and print anything you like.
Copied!
What do you think would happen if we remove the " (double quotation) marks from both sides of the text?
A syntax error occurs when the code is incorrect, which can be checked by testing.
Exactly the same. To print a message, you must correctly input the syntax for printing to avoid errors.
But don't worry, even professional programmers encounter errors. This type of error is called a Syntax Error because we did not follow the rules of the Python language. The Python language, like English or Persian, has a set of rules, and if you do not follow them, the computer will not understand your intent and will throw an error.
One of the rules of Python is that every piece of text must be enclosed in double quotes. Texts that are enclosed in double quotes are called strings. So, if a piece of text is not in double quotes, Python will consider it an unknown entity, which is why it throws an error.
Run the following program and see the error for yourself. Can you fix this program?
Copied!
Do you think Python understands Persian as well? Let's try it out.
Copied!
Yes, Python can understand and print Persian text. However, programmers usually use English. This reduces the chances of errors and makes the code more readable.