A buyer interested in goods offered by a vendor makes an inquiry about the price. Simulating this inquiry, the buyer is the client and the vendor the server.

The server script stores a dictionary to relate sizes of goods to prices. Use for example

  sizes = { 'small':12.3, 'medium':22.1, 'large':31.8 }.
The client prompts the user for a size: small, medium, or large; and sends the size to the server. The server receives a size, looks up the size in its dictionary and sends the corresponding price to the client. The client prints the price in the %.2f format.

  1. Give code for the client, defining the function buyer(s,b) where s is the socket and b the size of the buffer.

  2. Give code for the server, defining the function vendor(s,b) where s is the socket and b the size of the buffer.

  3. Give the main program for the server to deal with one client.

Answer: quiz11b_client.py and quiz11b_server.py.