Yesterday I announced a sweapstakes to give away a Codemy membership. In this video we’ll write some code to randomly select our winner! HINT: I picked more than one winner!

I took all the entries and added them to a Python list. I then converted the list into a Python set to automatically remove any duplicates, then converted it back to a Python list.

Next I generated a random number between 0 and the length of the list (minus one). Now we can use that to pick the winner from the list!

I wrapped the whole thing in a tKinter GUI so we would have something to look at!

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of...