FutureLearn – Object Oriented Programming in Python

I came across this course on the Raspberry Pi Certified Educators Course this October. It piqued my interest as it uses a text based adventure game to introduce OOP concepts to learners.

I had previously done this with an idea of a Space Invaders game using Visual Basic.NET. This was a fun introduction to concepts and it is easy to create classes and objects in VB. However my current cohort of learners are mostly unfamiliar with VB and have a better grasp of Python.

The course is written by Laura Sach, who I finally met at PiCademy after years of following her on Twitter. And I  thouroughly recommend it as an accessible way of understanding Object Oriented Principles in Python

https://www.futurelearn.com/courses/object-oriented-principles/

Heads Tails Heads – probability problem

Problem:

  1. Write a problem to simulate the tossing of a sequence of successive coin tosses.
  1. Search the suitably generated sequence to find a particular pattern, e.g., HTH. Report where this sequence was found – after how many flips in the generated sequence. Allow the user to enter the pattern to look for via the UI (User Interface).
  1. Modify your program to repeat steps 1 and 2 a variable number of times; allow the user to specify this value in the UI. Each repeat should use the same search pattern, but a new sequence of source coin tosses.
  1. Modify your program to keep track of where the pattern was found in each generated sequence. Report the overall average number of coin tosses required to the find the search pattern across all of the repeats.
  1. If your program is correct, you will find that the average number of tosses necessary to find the search pattern HTH is 10, however, HTT it is 8. Why is this (this is another conditional probability problem)?

Read more…