My professor doesn't always know what's actually correct or wrong - he always has to think about it for a very long time and get back to the book and read the book for a long time to answer any of our questions.
He says that
I tell you that an algorithm runs in $O(2^n)$ but yet is in $\mathsf{P}$. How can this be? Ans -> The big-$O$ notation is not a tight bound. Thus any algorithm that runs in polynomial time (e.g., $O(n^2)$) will also run in exponential time, such as $O(2^n)$. Thus, an algorithm that runs in $O(2^n)$ could be in $\mathsf{P}$.
Is he correct?
I cannot fully comprehend this answer. Could anyone please elaborate on his answer Please?