python solutions for some problems