PYTHON Lets Play A Game Of Zoom Bingo

PYTHON

Let’s play a game of Zoom bingo! The items for your bingo card will be selected at random from a list of items read from this website (/home/cords2/zoombingo.txt). There are instructions for this below. Create a 3X3 bingo card (you must use a list of lists where each sublist is a row in the card) by randomly choosing 9 items from the list of items read from the website. There must be no duplicates. Display the card. It might look something like this:

You’re on mute || Can everyone see my screen? || Next Slide Please

Can everyone please mute || Love your background! || We can’t hear you

Sorry I’m late || My microphone isn’t working || Can you hear me?

To play, ask the player if it is time to choose a new item. If the answer is yes (or “Y”), the computer will select an item from the list of items read from the website and will check the bingo card to see if the item is on the generated card. If yes, that item is replaced with the word “SEEN”. (The computer can select the same word multiple times – you do not have to keep track of what has been selected – although you can if you wish). After each choice, the card is checked for a “win”. A win is one horizontal line containing all the words “SEEN” or 4 corners with the word “SEEN”. So, for example, the following cards would be “Wins”:

You’re on mute || Can everyone see my screen? || Next Slide Please

SEEN || SEEN || SEEN

Sorry I’m late || My microphone isn’t working || Can you hear me?

OR

SEEN || Can everyone see my screen? || SEEN

Can everyone please mute || Love your background! || We can’t hear you

SEEN || My microphone isn’t working || SEEN

Inform the user once the game has been won otherwise, just keep asking them if it is time to select a new item. (Yes, this is a pretty dull game :-))

You may assume that the card is always size 3X3.

Reading words from the website.Note that the method that we used in the last assignment for reading the words will not work for this task because there is more than one word per line. Here’s an algorithm for reading one line at a time:

create an empty list to store the list of items

open the connection to the website, call the connection response

#read a line of the website and store it in a variable called “data” (see next line)

data = response.readline()decode(‘utf-8’))

#remove the end of line character from this string

while len(data) != 0: (#if len(data) == 0 we have reached the end of the file)

# add this string to the list of items

#read another line & remove the end of line character from the string