i need to design a python program that will calculate these two things. can someone help me out here?

Yes, you have to show some effort at first.

You calculate it on a paper, then tell python to do the same?!
Come on... give it a try....

Numpy has to have a function for it, I am sure...