Python core syntax
So far we have been using Python core operations that allow us to operate on strings, lists, integers, and floats. It’s natural for us to formulate expressions using algebraic symbols representing operators, or to get a number of elements in a sequence or dictionary.
We are able to add two or more strings together, which results in the strings’ concatenation; we are able to add integers and we know what the result should be, all done by using the “+” operator, but on respective data types.
Now, we'll use the same function len()
to get a number of elements of a tuple, list, dictionary, or characters in a string.
This is Python core syntax – an ability to perform specific operations on different data types, when operations are formulated using the same operators or instructions, or even functions.
Python core syntax covers:
- operators like '+', '-', '*', '/', '%' and many others;
- operators like '==', '<', '>', '<=', 'in' and many others;
- indexing, slicing, subscripting;
- built-in functions like str(), len()
- reflexion – isinstance(), issubclass()
and a few more elements.