La Boina Roja

The struggles off a future RHCE….

Leave a comment

The feeling

I had when I completed this exercise in one go without mistakes

cliccie for larger piccie

cliccie for larger piccie

Just raised my morale with 100% null nullnull(Ooh,  I didn’t even bother with reading about the trick for the so called “complicated” ones null)


1 Comment

Python vids at Khan Academy

cliccie for larger piccie

cliccie for larger piccie

Notice how I don’t call it a course and not recommend it? Let’s just say it is a good thing Salman Khan let other people deal with teaching others to program. These vids are hidden well, you cannot find them under “Computer Science” but you find them in “Science & Economics” called “Computer Science“. In my opinion it doesn’t deserve that name  photo talktothehand.gif

To be fair, I find it a bit awkward to be so harsh  photo bloos.gif as Salman Khan does a miraculous job at explaining math. Thanks to him and his great math vids I am considering programming. I am not going to say the vids are horrible, but he should just have some vids removed and the other vids regrouped somewhere else.

I will leave you with a list of pro’s and cons.


  • vids are usually not longer then 10 minutes
  • you don’t have to register to follow the “course”, if you do you get badges photo kwijl.gif
  • even though he uses mathematical concepts, mathematical knowledge is not required. He explains the concepts he uses really well, in his own brilliant way photo worshippy.gif
  • there are subtitles available for the vids
  • he visualizes Python concepts, those are the better vids, the best vid imho is where he explains binary numbers. I finally understand those!


  • it starts at beginner level and somewhere,  somehow it becomes complicated
  • there is no a real structure
  • even though I have gained some valuable insights, I miss the point of this course
  • it seems like he gave up on the course half way
  • some vids are useless, like “Python 3 Not Backwards Compatible with Python 2”. Really  photo pidown.gif a vid to explain that? In which he also discusses one single difference,  if I am not mistaken, between Python 2 and 3? Also why is this the 10th vid?
  • some vids are too long, like the “Insertion Sort Algorithm” vid
  • towards the end this “course” seems rushed photo nooo.gif

My overall opinion on this “course” is, don’t follow it from the beginning to the end, it is not worth your time. I would not recommend this “course” to a beginner. If you have difficulties grasping the concepts which he happens to discuss, just watch those instead. Especially the ones where visualizes those concepts.


Coursera starts a Python course on the 15th of April!

The course is called “An Introduction to Interactive Programming in Python”   and it’s free  photo thumbsup.gif  The course will cover Python 2.

Coursera is unfortunately one of those institutions that hasn’t implemented signing in by Google, Facebook etc. yet. But from what I’ve heard and read they give awesome classes. So it I think it is worth going through another sign up process again.

Since you’ve asked  photo piwink.gif no, I will not be joining that class.

Leave a comment

The abs() function visualized

The abs() function returns the absolute value of a number, it works like this:

cliccie for larger piccie

cliccie for larger piccie

If you are not the most gifted mathematician around  photo clown.gif and you need the some more explanation and/or visualization this vid will do the trick, it explains the concept rather well:

The vid is about 5 minutes long, imho you only need to watch the first two minutes to get it  photo nodding.gif

Leave a comment

Slicing in Python


Ha! Another trickety trick that is used on Python newbies is slicing. The trick is in getting the correct characters(in case of a string) or the correct items(in case of a list). They often make your mind boggle  photo piangry.gif by asking you first to use len() to check the length of a list(or string).

Let’s say you have this list:

the_list = [“Master Chief”, “James”, “Miranda Keys”, “Cortana”, “343 Guilty Spark”, “Deja”]

As you know, that even though there are 6 items in the list but Python will only index 5 items. That’s because Python starts indexing from 0. Don’t be fooled by len(), however!


As you can see len() returned 6, this is what makes slicing so tricky!

Always remember:

“Python counts from 1, but indexes from 0.”

And of course there is another thing to keep in mind( you really didn’t think it would be that easy right  photo emo.gif ), in case of slicing Python will always returns the before last index.

So if you would like to get a slice containing only the first two items, you should type this:

first_two = the_list[:2]

Why didn’t I type the 0? When your slice needs to have the first item in it there is no need to type the 0, you can do it though if you want.

Check the following screen shot where I’m attempting  photo piwink.gif to slice the first  two items (“Master Chief”, “James”).


Now, you know Python always returns the before last index. The next question will be to include the last item in your slice. Now what  photo redface.gif

You get the last item by typing the index of the first item you want and leave the space after the colon blank.(In this specific case we are talking about the 5th index, which happens to be the 6th item.) It looks like this:

ai = the_list[3:]


Remember slicing does not affect the original list! originallist

(You can always do the cliccy for a larger piccie!)

1 Comment

Get even with Modulo!


If you just started learning Python, one off the things people like to trick you with, is asking you to create a function with a code that should do something if it’s outcome is even. They expect you’ll mess around with stuff like “int”, type() etc.

But don’t be afraid  photo smile.gif it is very easy to create such a piece of code. Let’s say the parameter of your function is x and the code should evaluate (=check) if x is even. This is how you do it:

x % 2 == 0

See the % is called the Modulo, and when used as an arithmetic operator it returns the remainder of an integer division.

9 % 2 will return the remainder 1, 2 goes into 9 evenly 4 times.

12 % 4 there is no remainder, 4 goes into 12 evenly 3 times.

And as you know, no remainder equals to 0.

And of course if the outcome should be uneven you would use this:

x % 2 != 0

Leave a comment

Roja’s first code

Yesterday I was in a ranty mood, today I am happier. I just finished an assignment without looking for the answer by using google. Granted, I had to google how to define the third power, yes I am still working on those math skills  photo emo.gif
The code:

cliccie for larger piccie

cliccie for larger piccie

Yes, I know I could have left out “cubing = n**3” and just have typed “return n**3” instead photo puh2.gif Something I’ve learned after I’ve compared my code with other peoples code.

But for a first assignment all done by myself,  I am happy. When I read the assignment I decided that I should first spent 45 minutes non stop on writing this code before googling the answer. My action plan was to type only the stuff I know, and guess what happened? I finished the assignment within 10 minutes  photo biggrin.gif!