I had when I completed this exercise in one go without mistakes
Just raised my morale with 100%
(Ooh, I didn’t even bother with reading about the trick for the so called “complicated” ones
)
I had when I completed this exercise in one go without mistakes
Just raised my morale with 100%
(Ooh, I didn’t even bother with reading about the trick for the so called “complicated” ones
)
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
To be fair, I find it a bit awkward to be so harsh 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.
Pro’s:
Cons:
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.
by Roja 2 Comments
The course is called “An Introduction to Interactive Programming in Python” and it’s free 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.
The abs() function returns the absolute value of a number, it works like this:
If you are not the most gifted mathematician around 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
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 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 ), 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 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
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:]
(You can always do the cliccy for a larger piccie!)
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 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
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
The code:
Yes, I know I could have left out “cubing = n**3” and just have typed “return n**3” instead 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 !