Connection refused is generally due to a client not able to reach out the server. What is your environment; are you on a VM or on a MininetVM ? Are you connected to EPFL VPN or on the EPFL Wifi ? And is CodeC.py running concurrently on another terminal ?
If error persists don't hesitate to come today at practical session,
Best,
Gaiëtan.
One of the script is the server and the other one is a client. You should run both scripts in the same time (in separate terminals) and in the right order.