It is given the equation $x^2+px+1=0$, with roots $x_1$ and $x_2$;

(a) find a second-degree equation with roots $y_1,y_2$ satisfying the conditions $y_1=x_1(1-x_1)$, $y_2=x_2(1-x_2)$;
(b) find all possible values of the real parameter $p$ such that the roots of the new equation lies between $-2$ and $1$.
### Part (a)

Given the quadratic equation \(x^2 + px + 1 = 0\) with roots \(x_1\) and \(x_2\), we need to find a second-degree equation with roots \(y_1 = x_1(1 - x_1)\) and \(y_2 = x_2(1 - x_2)\).

1. **Sum of the roots \(y_1\) and \(y_2\):**

   By Vieta's formulas, we know:
   \[
   x_1 + x_2 = -p \quad \text{and} \quad x_1 x_2 = 1
   \]

   We need to find \(y_1 + y_2\):
   \[
   y_1 + y_2 = x_1(1 - x_1) + x_2(1 - x_2)
   \]
   \[
   y_1 + y_2 = x_1 + x_2 - (x_1^2 + x_2^2)
   \]

   Using the identity \(x_1^2 + x_2^2 = (x_1 + x_2)^2 - 2x_1 x_2\):
   \[
   x_1^2 + x_2^2 = (-p)^2 - 2 \cdot 1 = p^2 - 2
   \]

   Therefore:
   \[
   y_1 + y_2 = (x_1 + x_2) - (x_1^2 + x_2^2) = -p - (p^2 - 2) = -p - p^2 + 2
   \]

2. **Product of the roots \(y_1\) and \(y_2\):**

   \[
   y_1 y_2 = x_1(1 - x_1) \cdot x_2(1 - x_2)
   \]
   \[
   y_1 y_2 = x_1 x_2 (1 - x_1)(1 - x_2)
   \]
   \[
   y_1 y_2 = 1 \cdot (1 - x_1 - x_2 + x_1 x_2)
   \]
   \[
   y_1 y_2 = 1 \cdot (1 - (-p) + 1) = 1 \cdot (2 + p) = p + 2
   \]

3. **Forming the new quadratic equation:**

   The new quadratic equation with roots \(y_1\) and \(y_2\) is:
   \[
   t^2 - (y_1 + y_2)t + y_1 y_2 = 0
   \]
   Substituting the values we found:
   \[
   t^2 - (-p - p^2 + 2)t + (p + 2) = 0
   \]
   \[
   t^2 + (p^2 + p - 2)t + (p + 2) = 0
   \]

### Part (b)

We need to find all possible values of the real parameter \(p\) such that the roots of the new equation lie between \(-2\) and \(1\).

1. **Condition for roots \(y_1, y_2\) to lie in \((-2, 1)\):**

   Consider the inequality:
   \[
   -2 < x(1 - x) < 1
   \]

   This inequality can be solved by analyzing the quadratic function \(f(x) = x(1 - x) = x - x^2\).

2. **Analyzing the quadratic function:**

   The function \(f(x) = x - x^2\) is a downward-opening parabola with vertex at \(x = \frac{1}{2}\). The maximum value of \(f(x)\) is at \(x = \frac{1}{2}\):
   \[
   f\left(\frac{1}{2}\right) = \frac{1}{2} - \left(\frac{1}{2}\right)^2 = \frac{1}{2} - \frac{1}{4} = \frac{1}{4}
   \]

   The roots of \(f(x) = 0\) are \(x = 0\) and \(x = 1\).

   To satisfy \(-2 < x(1 - x) < 1\), we need to find the range of \(x\) such that \(f(x)\) lies within \((-2, 1)\).

3. **Finding the range of \(x\):**

   The inequality \(-2 < x - x^2 < 1\) can be split into two parts:
   \[
   x - x^2 > -2 \quad \text{and} \quad x - x^2 < 1
   \]

   Solving \(x - x^2 > -2\):
   \[
   x^2 - x - 2 < 0
   \]
   \[
   (x - 2)(x + 1) < 0
   \]
   The solution to this inequality is \(x \in (-1, 2)\).

   Solving \(x - x^2 < 1\):
   \[
   x^2 - x + 1 > 0
   \]
   The quadratic \(x^2 - x + 1\) has no real roots and is always positive, so this inequality is always true.

   Therefore, the range of \(x\) is \(x \in (-1, 2)\).

4. **Finding the range of \(p\):**

   Since \(x_1 x_2 = 1\), both \(x_1\) and \(x_2\) must be positive. We need to find the range of \(p = -(x_1 + x_2)\) given \(x_1, x_2 \in (0, 2)\).

   Let \(x_1 = a\) and \(x_2 = \frac{1}{a}\) for \(a \in (0, 2)\):
   \[
   p = -(a + \frac{1}{a})
   \]

   The function \(f(a) = a + \frac{1}{a}\) is minimized when \(a = 1\), giving \(f(1) = 2\). As \(a\) approaches 0 or 2, \(f(a)\) increases.

   Therefore, the range of \(p\) is:
   \[
   p \in \left(-\infty, -2\right]
   \]

   Additionally, if \(x_1\) and \(x_2\) are complex conjugates, the only value of \(p\) is \(-1\).

   Combining these results, we get:
   \[
   p \in \left(-\frac{5}{2}, -2\right] \cup \{-1\}
   \]

The final answer is \(\boxed{(-\frac{5}{2}, -2] \cup \{-1\}}\)