1. Introduction to the Python language¶
Programming languages are a way of telling a computer what to do. It's like giving orders to a robot, but instead of using words, we use a special language called code. Programming languages have their own rules and syntax, and each is suitable for different purposes.
Programmers write code to do things like create video games, desktop applications, mobile apps, or web pages. They can even use programming languages to analyze large amounts of data and make predictions.
Programming languages are used in a wide variety of fields, from computer science and engineering to finance and data analysis. Knowledge of a programming language is a valuable skill for anyone who wants to work in the field of technology.
In this course we will learn to program in Python language. Python is a very popular and very powerful programming language. It is used to do many different things, such as building web applications, analyzing data, creating artificial intelligence programs, and even controlling robots. It is a very easy language to learn and has a clear and simple syntax, which means that it is easy to read and write.
Also, there is a lot of information and resources available online for learning Python, making it even more accessible. You can find tutorials, books, and videos to help you get started programming in Python.
Would you like to be a programmer in the future? Learning Python is a great start! With dedication and practice, you can do a lot of amazing things with this language. Good luck on your Python learning journey!
Python's IDLE environment¶
To start programming we are going to open the standard Python programming environment, called IDLE. Click on the Windows icon and type the word IDLE. Then click on the IDLE icon.
A programming environment will appear like the one you can see in the following image:
Now, to start, we'll type a simple count: 5 + 16 and hit enter (or return) at the end. The screen will show the result in the following line:
We can write any simple operation or more complex operations. This environment is called an interactive environment, because Python receives typed commands and returns responses immediately.
Another way of programming is to create command files that will be executed later when we want. This other way of programming has the disadvantage of not being interactive, we do not receive a response to each order we write. The advantage of writing macros is that we can have many commands written to execute them whenever we want and as many times as we want.
To create a new macro, click inside IDLE on the
File option and then on
A new window will open where we can write orders, but without receiving responses. You can no longer see the cursor with three
>>> symbols. We will write within this window the orders that can be seen below:
When we're done, we'll save this exercise to the Python folder on data drive D:
Now we can run the program by clicking on the
Run menu or by pressing the
F5 function key. The result will be the following:
We can run this program as many times as we want and we can add as many commands as we want to the program.