Sunday 22 March 2015

Oh Bugger

We didn't do much in lecture this week except for go over minimax and understand how it's supposed to work.
One new thing we looked at was the assert statement. It showed up in the code for one of our labs and I everyone was pretty confused as to what exactly what its function was. Technically, if you think of the actual meaning of the word 'assert' you can yourself assert(aha see what I did there) what the statement is doing; it determines if a condition is met and raises and error if it is not. Its a useful tool to keep track of errors in loops and such. I honestly do not understand why or how it is more useful than just normal error checking practices but I think I need to use the concept a bit to be able to grasp it fully.
The other thing we covered this week was how to trace through complicated code that has function calls within itself. This helped me understand the multiple call system of recursion a bit better. Using the debugger is really a great way to visualize how python works and what steps it executes first. It helps you change your way to thinking as python would think so that you understand how to code your problem. Just keep stepping over how many ever times you want, its as helpful as pictures for recursion. Don't make the same mistake as Chuck Norris

No comments:

Post a Comment