6.00.1x Week 5 (Incomplete)

Efficiency How much time it takes for our program to run.

The function iterates elements in list L, if the element is equals to x, it returns true. This function continues to iterate until x is found, or if not found, returns false. There are two extreme cases here, if x happens to be … Continue reading 6.00.1x Week 5 (Incomplete)

6.00.1x Week 4

Our code does not always work as we intended, so we need to have some ways to debug it. Testing and debugging Testing methods Ways to test the program with examples to see if it work as intended. Debugging methods Ways to fix the program after you know it does not work as intended. Testing … Continue reading 6.00.1x Week 4

6.00.1x Week 3 (Problem Set)

There are two problems in this week’s problem set, one requires us to calculate the radiation exposure, another one requires us to program a hangman game. Radiation exposure Radioactive substance will undergo radioactive decay and emit radiation, over time, the amount of radioactive substance will reduce. The time required for a radioactive substance to reduce … Continue reading 6.00.1x Week 3 (Problem Set)

6.00.1x Week 3

This week, we learnt about recursion and different compound data types. Recursion Recursion means repeating similar version of something. In programming, a recursion function is a function that calls a smaller version of itself. It is useful for problems that can be represented as smaller version of themselves. The concept of recursion can be condensed … Continue reading 6.00.1x Week 3

6.00.1x Week 2 (Problem Set)

This week’s problem set deals with programming scripts that show what is the minimum amount of money a student has to pay in order to pay off his credit card balance in one year. There are 12 months in a year, and each month, interest will be incurred on the balance, the updated balance after … Continue reading 6.00.1x Week 2 (Problem Set)

6.00.1x Week 2

In week 2, I learnt to write functions in Python. The format of function in Python is as follows:

whereas in C, it is written as:

To program a basic function such as function to find the square root of a number, there are many approaches. We can use: 1. Linear search (exhaustive … Continue reading 6.00.1x Week 2

Starting MITx 6.00.1x Introduction to Computer Science and Programming Using Python 2014

I started another OpenCourseWare (free online course), MITx: 6.00.1x Introduction to Computer Science and Programming Using Python, provided by MIT and hosted on edX. I am currently also learning C with CS50x. When I was trying out the Project Euler questions, I realised that C cannot compute very large numbers, while Python can do it … Continue reading Starting MITx 6.00.1x Introduction to Computer Science and Programming Using Python 2014