Write a function which starts N processes in a ring, and sends a message M times around all the processes in the ring. After the messages have been sent the processes should terminate gracefully.
How do we solve in in python please help me by giving the script or logic.

Looks like a nice homework problem, maybe if you put some work into it first, you might actually get an answer.

See Homework Help

When you start posting code so we can help, use code tags

If you have absolutely no idea where to start, show us your design (how you think the program should work) and ask specific questions.