In this section I will give an example and will label every part of the codes so that we can read codes more easily.
FUCNTION
A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.
Lets create a FUNCTION that will compute our age. It is best practice to name the fuction to what it does or what the FUNCTION’s idea.
CLASS
Classes are use to make objects and each object can have different values from the same variable names
As an Aircon Specialist in my Mother’s business, One of my duties is to do computations of how much Horse Power needed in an area. I notice that this task is kept on repeating every day and I came up with the idea to automate this task with python. Below is the code I use in my program.
More of this on my GitHub account: https://github.com/Alyxx-The-Sniper/Various-Projects
Instance variables: emp_count == count the total objects created salary_multiflier (1.1) == accesible for all employee salary_multiflier (1.3) == will take effect for the Class Supervisor only
Methods: compute_salary add_emp == for Class Supervisor only del_emp == for Class Supervisor only
More of this on my GitHub account: https://github.com/Alyxx-The-Sniper/Various-Projects