Original article was published by Bharath K on Artificial Intelligence on Medium
Basic Starter Projects
1. Simple to advanced Calculator:
This basic project to be implemented can be done in any way you choose. Let us analyze how the execution of this simple calculator project is done for each class of difficulty. I will begin with beginner’s implementation of simple calculators, but even if you have basic programming knowledge, stick on till the next part of this section as I have suggestions for taking this project to the next level as shown in the above image.
If you are a beginner and you are just getting started with python, then please refer to the starter code provided below, which is one of the best ways you can understand the use of functions in python.
With just a simple code as displayed above, you have successfully created four functions to compute the four basic operations of a calculator. To take the two inputs from the user for the calculation purpose, you can use the following code block assignment.
After executing the following code block, I will assign my two numbers like 5 and 2, for the interpretation of the calculations. You can feel free to declare any number you desire as per your requirement. The answers you should get for the following assignments should be as follows:
Enter the first number: 5
Enter the second number: 2
The Sum is: 7
The Difference is: 3
The product is: 10
The answer is: 2.5
This part completes the simple calculator program. However, this is not even close to the end. There are a ton of improvements to be made with the use of various techniques. Let us discuss how we can accomplish this task. For the intermediate-level programmer, I would highly suggest that you go beyond the two input integers to a higher n-element approach by making use of the *args option available for functions. Then, try to use classes for understanding that concept more precisely and develop a more complicated calculator.
For more advanced or expert level construction of the same project, look into graphical user interface libraries like Tkinter. Using this module, users can develop an awesome GUI structure for your calculator. There are also other graphics modules you can use, but I would personally recommend Tkinter as a good starting point. Refer to the amazing code snippet provided by Programming Knowledge user in the GitHub link in the image above for a concise guide on the calculator development.
2. Matrix Multiplication Without Machine Learning Libraries:
An important aspect of python and machine learning is understanding the math behind these concepts and knowing how some of the code in machine learning libraries. To have a better grasp of these concepts, it is essential to practice the ideas implemented in scientific modules like numpy and scikit-learn by ourselves. One such programming application is performing the matrix multiplication operation without using any ML libraries.
To perform this task, the main requirement is knowledge of how matrices works. The complete explanation and guide can be obtained from my article below. However, if you are just interested in the basic gist of this coding problem and want to try to solve this on your own, then use the next reference paragraphs to help you get started.
My approach to this problem is going to be to take all the inputs from the user. These are the number of rows and columns of both the first and second matrix. Also, based on the number of rows and columns of each matrix, we will respectively fill the alternative positions accordingly.
The first step, before doing any matrix multiplication is to check if this operation between the two matrices is actually possible. This can be done by checking if the columns of the first matrix matches the shape of the rows in the second matrix. This can be formulated as:
→ no. of columns in matrix 1 = no. of rows in matrix 2
This should be a great starting point for you to get started.