I’m going to sum up the experiences of the past week and share what I managed to find out.
First off, I really like the way the MOOC is organised. Especially the way it encourages team work and p2p-learning process. First the instruction was to sign up for OpenStudy, which is very good in terms of mutual help and revision. But there’s a problem there. You can ask questions there alright, but you can ask only one question at a time. That is, after you asked your question, it appears on the questions wire and everyone can see it and answer it. But if you want to ask another question, you’ll have to mark the current one as ‘closed’ and only then you’ll have an option to ask a new one. ‘Closed’ means that it is removed from the wire shown by default (to the list of closed questions) and if you haven’t received the answer so far, there’s a chance you’ll never have it because nobody will notice the question.
Ah yes, also OpenStudy is often down, so you sometimes simply can’t use it.
But there are great options outside. First is that the MOOC organisers divided all MOOCsters into teams and provided them with mailing list addresses, so some questions cans be asked and answered in small groups and you have no limitations here.
Finally, there’s one more learning space I discovered only yesterday and haven’t tried yet, but it looks great. I mean Groups at Codecademy (you have to sign in to see the page). Although I’ve been using Codecademy for quite a while now, I didn’t know about their existence. Of course I immediately joined Python for Beginners group. I hope it’ll be a great experience.
Now a couple of words about this week’s homework. This week was rather challenging for me, because I was struggling to understand how loops work, especially the for loop. One of the tasks was to write a code that calculates exponentials using a for loop. Thanks to my team mates who helped me figure out what the task was about in the first place – that is that the task should be executed without using the in-built exponentiation (**) option.
Now, I had dealt with for loops at Codecademy and found them rather easy. This is what I basically imagined:
for i in range(1, 10, 2):
print i
So it does what you tell it to with all the items in a range.
But in this case a possible resulting code I got after many efforts (and quite a bit of guesswork, I admit) looks like this:
base = input("Enter base: ")
exp = input("Enter exponent: ")
x = base
for n in range(1, exp):
x *= base
print x
So after I wrote it, I still had a question: how are for n in range(1, exp):
and x *= base
connected if there are no obvious operations in which n (the items from the range) are mentioned? The answer is obviously that they don’t have to be mentioned. That is, the for loop in this case is used to show the computer how many times the operation must be repeated.
This is what I realised after reading this awesome article about loops in Python. And I also realised that there’s a great way to see what programme does by adding print
statements that reflect the process step by step. Like so:
base = input("Enter base: ")
exp = input("Enter exponent: ")
x = base
for n in range(1, exp):
x *= base
print x # This shows what's going on in the process
print x
So for instance if we have base 5 and exp 4, the output will be:
25
125
625
625
Also one of my team mates kindly recommended me to read Learning Python by Mark Lutz (I found out on the way that there’s a whole site about it).
Finally, I played with PyScripter IDE and explored some code sharing options, which I’m going to describe soon.
Oh, by the way, if some peers want to have a look at my whole homework (with the exception of optional tasks I’ll get back to them a bit later), it’s here: https://gist.github.com/ansakoy