How can i edit this code to rotate my player to fixed angles when a key (or a combo of keys) is pressed?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
public float speed;

private Rigidbody2D rb;
private Vector2 moveVelocity;
private float lookleft;
public KeyCode A;

// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();

}

// Update is called once per frame
void Update()
{
    Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    moveVelocity = moveInput.normalized * speed;

    if (Input.GetKeyDown(KeyCode A) = lookleft)
    {
       
    }
}

void FixedUpdate()
{

rb.MoveRotation(rb.rotation + Time.fixedDeltaTime);

}
,using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
public float speed;

private Rigidbody2D rb;
private Vector2 moveVelocity;
private float lookleft;
public KeyCode A;

// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();

}

// Update is called once per frame
void Update()
{
    Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    moveVelocity = moveInput.normalized * speed;

    if (Input.GetKeyDown(KeyCode A) = lookleft)
    {
       
    }
}

void FixedUpdate()
{

rb.MoveRotation(rb.rotation + Time.fixedDeltaTime);

}

Ok, get rid of the look left float. The code below will just pop to the rotations given, but you can smoothly turn via Quaternion.Slerp for example. If your idea is to use the rigidbody to rotate, AddTorque() will gradually spin around the axis specified in the vector (you want to turn left AddTorque(0,2,0) for example), but hitting an exact fixed amount will be hard.

if (Input.GetKeyDown(KeyCode A) )
     {
        //look left
transform.rotation = Quaternion.LookRotation(-transform.right, Vector3.up);
     }
if (Input.GetKeyDown(KeyCode D) )
     {
        //look right
transform.rotation = Quaternion.LookRotation(transform.right, Vector3.up);
     }
if (Input.GetKeyDown(KeyCode S) )
     {
        //look back
transform.rotation = Quaternion.LookRotation(-transform.forward, Vector3.up);
     }