why does italy have both a prime minister and president
The executive power is exercised collectively by the Council of Ministers, which is led by the Prime Minister, officially referred to as President of the Council (Presidente del Consiglio). Legislative power is vested in the two houses of the Italian Parliament primarily, and secondarily on the Council of Ministers, which can introduce bills and holds the majority in both houses. The judiciary of Italy is independent of the executive and the legislative branches. It is headed by the High Council of the Judiciary, a body presided over by the President of Italy, who is the head of state though his position is separate from all branches. The current Italian President is Sergio Mattarella and the current Prime Minister of Italy is Paolo Gentiloni.
Politics of Italy