In order to be able to write programs, you must first choose a programming language that allows you to describe the different operations that the developed program must perform. There are hundreds of different programming languages, each with its own specificities. Python, is a newer and modern language that can be used to code a wide variety of different programs. This article presents this language and introduces the concepts of importing a library using python and it will show a simple of that.
The Python programming language was created by Guido van Rossum in 1990 and is made available under a free license. It is currently being developed by the Python Software Foundation, founded in 2001. It is an interpreted language that works on most computer platforms (in particular Linux, Windows and macOS). It is also very popular with educators who consider it a good language for learning about basic programming concepts.
The image above shows the Python logo to the left of its creator, Guido van Rossum. In 1999, the latter submitted a project to the Defense Advanced Research Projects Agency (DARPA), an agency of the United States Department of Defense responsible for the development of new technologies intended for military use. In his proposal, called "Computer Programming for Everybody" (original document), he defined the following goals for Python:
the language must be simple and intuitive, and as powerful as the main competitors;
it must be open source, so that anyone can contribute to its development;
the code must be as understandable as a text in English;
it must be adapted to daily tasks, and allow short development times.
Using the import function to important libraries
Python you don't have to write everything from the ground up. The language utilizes a large number of libraries that you can import and use to perform a great deal of actions.
The above code shows a simple program written in python. The program will display the use of importing libraries in this case we are importing the mean and median functions from the statistics library.
The program will loop indefinitely asking a user to enter numbers from 100 to 1000 until the user enters 0 to quite the program. The numbers are saved in a list called listeOfValues. Then, the program will calculate the average of these values by using the mean() function from the statistics library. The program will also calculate de median of the chosen values.
After installing python, you can copy the program and play with it to see the ease of use of this language.
To learn more about python visit the links bellow: