4. Three friends went to study to become a cook, a carpenter, and a painter. When they met their classmates, they said about their place of study: Victor - cook; Andrey - not a cook; Petr - not a carpenter. It is known that either Petr or Andrey made a mistake. Determine the profession each of them went to study.
4. We know three statements, and it is said that either Andrey or Petr made a mistake. Let's consider each of these cases.

1 case. Suppose Andrey made a mistake. Then Andrey is the cook. And according to the first condition, Viktor is also a cook. Two people cannot be a cook at the same time. In this case, there is no solution.

2 case. Suppose Petr made a mistake. Then Petr is the carpenter. And according to the first condition, Viktor is the cook. Therefore, Andrey is the painter.

Answer: Petr - carpenter, Viktor - cook, Andrey - painter.