Rotate slowly,Rotate a sprite slowly at the push of a button

Hello,
I am currently trying to create a geometry dash clone and have a problem with the rotation of the jump. i would like my player to rotate 180 degrees like in the original. currently he only does it very abruptly. in the attached code you can see a simple push button rotation but i want it to rotate slowly. Can somebody help me with it? (Sorry for the Bad English)

void Update()
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
            float y = transform.position.y;
            StartCoroutine(jump(y));

            transform.Rotate(0, 0, -180);
        }
    }

You can also make an animation. It‘s easier and looks better.