3.Build a simple application

3.Build a simple application


No alt text provided for this image

Let's write a very simple program in Python. This program displays a message. Run IDEL from the Start menu as follows:

No alt text provided for this image

Clicking on IDEL will display the following page:

No alt text provided for this image

On the page that opens, click on the File menu and then the New File option:

No alt text provided for this image

Clicking on the New File option will display the following page where you can write your own code:

No alt text provided for this image

In the window above, type the following code:

print("Welcome to Python Tutorials!")
No alt text provided for this image

Click Save as the following from the File menu:

No alt text provided for this image

Then select a path to save the file. We have saved the file in drive C as follows:

No alt text provided for this image

After saving the file go back to the coding environment and from the Run menu, select Run Module or F5:

No alt text provided for this image

You will see the program running and the message! Welcome to Python tutorials being printed:

No alt text provided for this image

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!")

To view or add a comment, sign in

More articles by Mohammad Moradi (He/Him)

  • 8.Getting user input

    Python provides the input () method to retrieve user input. As the name implies, it reads all the characters you type…

  • 7.Phrases and Operators

    Learn two words first: Operator: are symbols that perform specific actions. Operand: The values that the operators…

  • 6.Convert data types

    In Python, it is possible to convert one type to another, so-called Type Casting. Python has a set of predefined…

  • 5.Data types

    The types of data available in Python are: Using variables: Unlike languages like Java and C #, where we had to specify…

  • 4.Control characters

    Control characters are composite characters that begin with a backslash (\) followed by a letter or number and…

  • 2.Download and install Python 3.8

    There are various development environments or IDEs for programming in different languages that help programmers write…

  • 1.What is Python

    Python is a versatile, object-oriented and open source programming language designed by Guido van Rossum in 1991 in the…

  • the mark @ in C#

    The @ mark allows you to override the control characters and create a more natural, readable string. When using control…

  • 31.Class as field

    Like all the variables we have used so far, one class or structure can be converted to another class member variable…

  • 30.Nested class

    Sometimes it is necessary to define a class in another class. The most important reason for this is to limit the scope…

Explore content categories