Computers and Technology

You will create a simple client server program with a language of your choice (python is highly recommended) where a server is running and a client connects, sends a ping message, the server responds with a pong message or drops the packet.You can have this program run on your machine or on the cse machines. Note that you will run two instances of your shell / IDE / whatever and they will communicate locally (though over the INET domain) - you can connect to your localhost (127.0.0.1 or make use of the gethostname() function in python).Use UDP (SOCK_DGRAM) sockets for this assignment (parameter passed to socket()).useful links:https://docs.python.org/3/library/socket.htmlhttps://docs.python.org/3/library/socket.html#exampledetails:client.pycreate a UDP socket (hostname and port are command line arguments or hard coded).send 10 (probably in a loop) 'PING' message (hint: messages are bytes objects (Links to an external site.))wait for the response back from the server for each with a timeout (see settimeout() (Links to an external site.))if the server times out report that to the console, otherwise report the 'PONG' message recievedserver.pycreate a UDP socket and bind it to the hostname of your machine and the same port as in the client (again either command line or hardcoded).infinitely wait for a message from the client.when recieve a 'PING' respond back with a 'PONG' 70% of the time and artificially "drop" the packet 30% of the time (just don't send anything back).Server should report each ping message and each dropped packet to the console (just print it)hint: for the dropping of packets, use random number generation (Links to an external site.)You will submit 2 source code files (client.py and server.py), a README file that explains how to run your program as well as screenshots of your program running (they can be running on your own machine or the CSE machine). NOTE: your screenshot should include your name / EUID somewhere (you can print it at the beginning of your program or change the command prompt to your name, etc)Example client output (Tautou is the hostname of my machine, 8008 is a random port i like to use - note you can hard code your hostname and port if you prefer): python client.py Tautou 80081 : sent PING... received b'PONG'2 : sent PING... Timed Out3 : sent PING... Timed Out4 : sent PING... received b'PONG'5 : sent PING... received b'PONG'6 : sent PING... Timed Out7 : sent PING... received b'PONG'8 : sent PING... received b'PONG'9 : sent PING... received b'PONG'10 : sent PING... received b'PONG'example server output: python server.py 8008[server] : ready to accept data...[client] : PING[server] : packet dropped[server] : packet dropped[client] : PING[client] : PING[server] : packet dropped[client] : PING[client] : PING[client] : PING[client] : PING
Working with Categorical Variables The columns cut, color, and clarity are categorical variables whose values represent discrete categories that the diamonds can be classified into. Any possible value that a categorical variable can take is referred to as a level of that variable. As mentioned at the beginning of these instructions, the levels of each of the variables have a natural ordering, or ranking. However, Pandas will not understand the order that these levels should be in unless we specify the ordering ourselves. Create a markdown cell that displays a level 2 header that reads: "Part 3: Working with Categorical Variables". Add some text explaining that we will be creating lists to specify the order for each of the three categorical variables. Create three lists named clarity_levels, cut_levels, and color_levels. Each list should contain strings representing the levels of the associated categorical variable in order from worst to We can specify the order for the levels of a categorical variable stored as a column in a DataFrame by using the pd. Categorical() function. To use this function, you will pass it two arguments: The first is the column whose levels you are setting, and the second is a list or array containing the levels in order. This function will return a new series object, which can be stored back in place of the original column. An example of this syntax is provided below: df.some_column = pd.Categorical(df.some_column, levels_list) Create a markdown cell explaining that we will now use these lists to communicate to Pandas the correct order for the levels of the three categorical variables. Use pd. Categorical() to set the levels of the cut, color, and clarity columns. This will require three calls to pd. Categorical(). Create a markdown cell explaining that we will now create lists of named colors to serve as palettes to be used for visualizations later in the notebook. Create three lists named clarity_pal, color_pal, and cut_pal. Each list should contain a number of named colors equal to the number of levels found for the associated categorical variable. The colors within each list should be easy to distinguish from one-another.