how to generate the dummy variable for this variable?

chiaoyi
Please see the Forum's Homework Policy.
FAQ: Homework Policy

The first line assigns your example list, to a named object with the name participated
You could assign your own list to the same name