We can have acceptance with empty stack, but in that case our stack at the start has to have a A in it, otherwise this machine will accept the empty string which is wrong
But can we have a non empty stack at the start? is my method right?
But can we have a non empty stack at the start?
By the formal definition PDA has the initial stack symbol $Z$ with which a computation starts.
The idea is to use three stack symbols $Z, Z_{even}, Z_{odd}$ to keep track of whether the number of $a$s read so far is even or odd. If the PDA reaches the end of string and topmost symbol is $Z_{odd}$ then empty the stack.