Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Know
Python is one of the best coding languages that a developer should learn to boot his or her career.
There are many big sites such as Instagram, Netflix, Uber, Pinterest, and Dropbox, which have
been created using python programming language. In this case, skilled Python programmers are in
high demand, not only because of the popularity of the language but mostly because it has grown
to become a solution to many different problems in the software development world. Python has
been used in various developments, such as web applications, machine learning, and data science.
As a Python fan, I believe that there are certain essential concepts or facts that every Python
developer should know. All these were important were necessary concepts within the period I
learned using Python as my main programming language. One needs to be familiar with sites such
as the official Python website, Python 2 and 3 documentations, and stack flow. In this article, I
will discuss the 12 Things Every Python Developer Should Know.
import sys
print(list2)
'''
list2 = [(0, 0, 0), (0, 0, 1), (0, 0, 2), (1, 1, 0), (1, 1, 1), (1,
1, 2), (3, 9, 0), (3, 9, 1), (3, 9, 2), (4, 16, 0), (4, 16, 1), (4,
16, 2)]
'''
COPY SNIPPET
Just as the Python 2.7.5 documentation states, one can create a nested list via list comprehension,
and it is mainly significant whenever a developer needs to initiate a matrix or a table.
def count_zeros(string):
total = 0
for c in string:
if c == "0":
total += 1
return total
# 3
print (count_zeros ('00102'))
COPY SNIPPET
Moreover, the recursive functions are also not complicated, and they have a similar character as
some object-oriented programming (OOP) languages. Unlike other programming languages such
as Java, Python uses few classes, making a developer's expertise in the expertise to be quite limited.
The Python 2.7 documentation describes classes as:
Python classes provide all the standard featutes of Object Otiented Programming: the class
inheritance mechanism allows multiple base classes, a derived class can override any methods of
its base class or classes, and a method can call the method of a base class with the same name.
Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of
the dynamic nature of Python: they are created at runtime, and can be modfied further after
creation.
File Management
Most python scripts use files as their inputs, thus making it important to understand the best way
of incorporating the files in your code. In this case, the open keyword serves a great purpose since
it is straightforward, and the programmer can loop through the file to analyze it in each line. The
alternative is that one can employ readlines () method which helps create a list that comprises of
each line in the file, but it is only efficient for smaller files.
Slicing
This is a process that involves taking a subset of some data, and it is mostly applied to lists and
strings. Slicing is not only limited to just eliminating one element from data. In this case, for
programmers to have a better intuition about slicing, they have to understand how the process of
indexing works for negative numbers. In the Python documentation, there is an ASCII-style
diagram in the Strings section which advocates that the developer should think about Python
indices as pointing between data elements. One can employ the Python shell to play around with
semi-complicated slicing before using your code.