How to know how much RAM & CPU my script reqire?

as the title, how to know? is task manager the best way as my friend told me?
I code in python..

I’m new here sorry if my question was in the wrong place.