You'll be fine most anywhere in University City or Center City. Hip areas like Fishtown, Northern Liberties, and Old City could work. These areas are all going to be relatively expensive. The further out you go the cheaper it gets (relatively). You could look at the City Ave. area (around St. Joe's University and PCOM) or East Falls, Manayunk, etc. You can get to Penn from these areas relatively easily by train or bus.
Less safe areas to avoid would be regions of North Philadelphia and parts of West Philadelphia outside of the areas around Penn and Drexel.