TypeError), which is a drawback. Duck typing is a concept related to dynamic typing, where the type or the class of an object is less important than the methods it defines. When you use duck typing, you do not check types at all. Instead, you check for the presence of a given method or attribute. For example, we can call the len() method on any Python object that defines a .__len()__() method. In order for you to call len(obj), the only real constraint on obj is that it must define a .__len()__() method. Python examines data to determine its type. Python knows that integers are used for math and words are used in communication, so the programmer doesn't have to explain to Python how to use the data it finds in variables. Python uses duck typing to figure it out on its own, and does not attempt to do math on strings or print the contents of arrays (without iteration), and so on. What duck typing means is, we don’t actually know if the object is a duck, we infer/reduce from a list of behaviour that the object is a duck. It is important to observe that we are not checking internally if the two objects are the same, but rather using known external behavior to match the two objects. Another example of duck typing is that we can write a for loop for every iterator type.pypi.python.org, we can view 3rd party libraries. We can use pip install package_name to install the package. PIP can also install dependencies, uninstall packages etc.python3 -V will tell the Python version installed. It is in /usr/local/bin/python3.#!/usr/bin/env python3 should be the first line (this is common in Unix like systems for scripts to have the shebang line), where we are using the env command (which is a Unix program) to find the path for python executable. When you execute a file from the shell, the shell tries to run the file using the command specified on the shebang line. The hash character is used because it defines a comment in most scripting languages, so the shebang line will be ignored by the scripting language by default. The shebang line was invented because scripts are not compiled, so they are not executable files, but people still want to "run" them. The shebang line specifies exactly how to run a script. In other words, this shebang line says that, when I type in ./basics.py, the shell will actuall run /usr/bin/env python3 [basics.py](<http://basics.py/>). /usr/bin/env is a utility that uses the user's path to run an application (in this
case, python3).type(var_name) will give us the type of variable./ Division, ** Exponentiation, % Modulo, // Integer Division<aside>
💡 Python converts all ints to floats before performing division, /
</aside>
#and, or, notvariable = true_val if condition else false_value