Recursion in programming means a function that call itself inside of it. Recursion pops up in lots of places in both math and computer science. Sometimes some problems are not able or not easily to solve in a loop way, but can be able to solve in recursive way in least steps. The recursion is an idea of “divide and conquer”. The problems that are solved by recursion can be divided in to two part: “base case”, and “recursive steps”. Normally the “base case” is the condition that helps the function “escape” from the recursion, otherwise, it will cause infinity loop (stack overflow). And the “recursive steps” are the deductive steps of the problems.
Continue reading “Recursion”Object-Oriented Programming (OOP)
As we may know, programming languages can be divided in two different paradigms, Procedure-Oriented and Object-oriented. Early computer programming was based on a procedure-oriented approach, where problems could be solved by designing algorithms. C is a classical procedure-oriented programming language. But with the continuous improvement of computer technology, computers are being used to solve increasingly complex problems. Therefore, objected-oriecnted was developed. Through object-oriented methods, it is more conducive to analyzing, designing, and programming complex systems in a way that is understandable to humans.
Continue reading “Object-Oriented Programming (OOP)”Numpy and matplotlib
Numpy
“Numpy” is a important module in Python for doing numerical computations in a optimized way. Numpy stands for “numerical python”. Numpy is used for working with arrays as a Python library, which has functions for working in domain of linear algebra, fourier transform, and matrices. It also contains all the usual math functions, its own version of random module, and its own special data types, like “arrays”.
Continue reading “Numpy and matplotlib”Lambda, map, filter, and arbitrary inputs
Lambda functions
The Lambda functions are nice for Calculus functions or ant one-line function with a simple input-output format. They can also be used to create functions “anonymously”. A Lambda function can take any number of arguments, but can only have one expression. Using a Lambda function, we can make our codes more concise.
Continue reading “Lambda, map, filter, and arbitrary inputs”Modules
Python has build-in many functions, but we can still access even more functions when we “import” a “module”. A module works like a library. Since python is open source, more and more developers are working on improving the existing modules and developing new modules. What’s more, we can even make our own modules too. It’s very useful for reusing our codes and simplifying the development procedure.
Continue reading “Modules”Control Structure and Text files
Conditionals
Similar to other programming languages, python also uses “if” statements for conditions. But python uses “elif” instead of “else if” for following conditions. Besides, python neither use parenthesis (“()”) to cover the conditions nor use curly brackets (“{}”) to cover the blocks. Instead, it’s necessary to indent our codes to make sure they are covered by either conditions or loops.
Continue reading “Control Structure and Text files”Python Containers
Containers are mostly common used in not only python but also other programming languages. Container is a datatype that can hold more than one elements. In python, contains can be list, tuple, set, and dict.
Continue reading “Python Containers”Python Basis
Python was designed by Guido van Rossum in 1990 as a replacement of ABC language. It provides efficient and advanced data structures which make it become a simple and efficient object-oriented programming language. With the continuous updates of versions and the addition of new language features, it is gradually being used for the development of independent and large-scale projects.
Continue reading “Python Basis”