You will write two functions that do what packet switching does at each end: cut a message into numbered packets, and put mixed-up packets back in order.
Your tasks.
make_packets, return a list of (number, payload) pairs. Cut message into pieces of size characters. Number the pieces from 1.rebuild, sort the packets by their number and join the payloads into one string.count to the number of packets needed for the message "SEE YOU AT NINE" with a payload of 4 characters. Use make_packets.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…