1Introduction to Python R and Data Science
1.1 What Is Python?
Python is a programming language that lets you work more quickly and integrate your systems more effectively. It was created by Guido van Rossum. You can read Guido’s history of Python at the History of Python blog at http://python‐history.blogspot.in/2009/01/introduction‐and‐overview.html.
It is worth reading for beginners and even experienced people in Python. The following is just an extract:
many of Python’s keywords (if, else, while, for, etc.) are the same as in C, Python identifiers have the same naming rules as C, and most of the standard operators have the same meaning as C. Of course, Python is obviously not C and one major area where it differs is that instead of using braces for statement grouping, it uses indentation. For example, instead of writing statements in C like this
if (a < b) {
max = b;
} else {
max = a;
}
Python just dispenses with the braces altogether (along with the trailing semicolons for good measure) and uses the following structure:
if a < b:
max = b
else:
max = a
The other major area where Python differs from C‐like languages is in its use of dynamic typing. In C, variables must always be explicitly declared and given a specific type such as int or double. This information is then used to perform static compile‐time checks of the program as well as for allocating memory locations used for storing the variable’s value. In Python, variables are simply names that refer to objects. ...
Get Python for R Users now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.