A few people rate a film from 0 to 10, and each one hears what their friends think. Write update(opinions, friends): everyone’s new opinion after hearing their friends. friends[i] lists the positions of person i’s friends. Your own opinion counts as one voice too.
| Ana | Ben | Cai | Dee | Eve |
|---|---|---|---|---|
| 2 | 8 | 4 | 10 | 6 |