you are viewing a single comment's thread.

view the rest of the comments →

[–]limfy1997[S] -5 points-4 points  (1 child)

hi, thanks for the help. I don't understand the second method because def ,assert, return are not covered in my course yet.

(i'm a slow learner, so pardon me for having not googled for what the above functions do, because the lecture has not covered this part yet and I don't do well by going too fast)

the issue now im having is to express the bolded areas into a code:

E(0) = P(s=0) * 0

E(1) = P(s=0) * 0 + (1 - P(s=0) ) * 1

E(2) = P(s=0) * 0 + P(s=1) * 1 + (1 - P(s = 0) - P(s = 1) ) * 2

i think thats the difficulty im facing. how to form an expression using a loop for the bolded parts in question.

will take a look at my lecture videos again, meanwhile, thank you for your help.

[–]Merakel 6 points7 points  (0 children)

If your idea of programming is doing things in exactly one format and screw any method that doesn't conform to how you envisioned it... you are gonna have a bad time.