3.Build a simple application
Let's write a very simple program in Python. This program displays a message. Run IDEL from the Start menu as follows:
Clicking on IDEL will display the following page:
On the page that opens, click on the File menu and then the New File option:
Clicking on the New File option will display the following page where you can write your own code:
In the window above, type the following code:
print("Welcome to Python Tutorials!")
Click Save as the following from the File menu:
Then select a path to save the file. We have saved the file in drive C as follows:
After saving the file go back to the coding environment and from the Run menu, select Run Module or F5:
You will see the program running and the message! Welcome to Python tutorials being printed:
The example above is the simplest application you can write in Python. The purpose in the example above is to display a message on the screen. Every programming language has rules for coding.
Python has predefined functions that are each used for a specific purpose. Although we will explain more about functions in the future, we will limit ourselves to justifying the function that functions are a set of codes that have a name and are marked () in front of them.
One of these functions is print (). The print () function is used to print a string. A string is a group of characters, enclosed by a double quotation mark (“). Such as: "Welcome to Python Tutorials".
A character can be a letter, a number, a symbol or ... The example above is how to use the print () function. Further explanation is provided in future lessons. Python overrides the space between the (), [] and {} symbols. For example, the following code does not bug:
print(
"Welcome to Python Tutorials!")
Always remember that Python is case-sensitive. That is, for example MAN and man in Python are different. Strings and explanations are an exception to this rule, which we will explain in future lessons. For example, the following codes are encountered and not executed:
Print("Welcome to Python Tutorials!")
PRINT("Welcome to Python Tutorials!")
PrinT("Welcome to Python Tutorials!")
Changes in uppercase and lowercase letters prevent code execution. But the following code is completely error free:
print("Welcome to Python tutorials!")