Exercise: Predicting Election Results

In this exercise, you will predict election results from a sample of randomly chosen people.

We'll cover the following


Consider an election where one million (1,000,000) people will vote.

  • 490,000 people will vote for Mr. Arthur

  • 510,000 people will vote for Mr. Ben.

One day before the election, a private company, Octavius, conducts a poll among 1000 randomly chosen voters.

Problem statement 1

Compute whether Octavius will predict the winner correctly using the approach explained above and print the answer. Voters of Arthur are identified by 00 and those of Ben are identified by 11.

Use the choice function to extract random values from the voter sample.

Set the value of seed to 2.

Get hands-on with 1200+ tech skills courses.