Introduction to Python
What can Python do?
Last updated
Was this helpful?
What can Python do?
Last updated
Was this helpful?
Coding or programming is the process in which we give certain instructions to our computer so that it can perform a task, such as calculating something.
A programming language is a language that we can use to tell the computer what to do. Just like every other language, it has rules of its own about how to write code. It gives us the guidelines for the layout of words and symbols for any task we might want the computer to do. You can think of it as any language such as English, Spanish, or Chinese. It tells us what format, structure, and syntax we have to use so that the computer will do what we want it to do.
Python is one of the many programming languages that exist, and is the main programming language we will use during this course. It is a general-purpose programming language that is not only used in data analysis and visualization, but also to develop web apps.
We will be using Python as a tool to process and analyze data. To get started, let's discuss the basics of Python's format.
In the last section, we showed the command line, and how the computer is waiting for you to tell it what to do. When the computer is ready for you to type, it will display three arrows that look like this: >>>
. You will not need to type these arrows, they will appear automatically. Here is a picture of what they will look like in the command line.
These arrows show up when the computer is ready for you to type something. If there are no arrows, then the computer is working on what you last wanted it to do.
However, when we use the Jupyter Notebooks, these arrows will be invisible. Instead, the command line will look like this:
In our examples, we will type the arrows, but they are not necessary in Jupyter.
Before we start, any code, let's see what happens when we input information into the command line:
In the example above, Python takes the input after the prompt >>>
, evaluates it, and displays whatever the input evaluates to in the next line. We will get to more complicated examples as we continue. For now, know that Python takes in an input where there is a prompt >>>
and displays the output in the next line.
Syntax in a language is a set of rules that tell us how we can correctly combine words or symbols in order for the computer to understand what we want it to do.
Input is the information we give our computer so that it can do the task we asked it to do.
Output is the result of the task that the computer will give back to us once it is finished.