Homework #1 number guess game

This program did fulfill all the specifications and some of the extra credit. It does allow you to play again even if you guess wrong but doesn't quite work right if you try to play again after winning. I think it has something to do with the order of the nested if statements. I fell asleep before I finished fixing it. It does allow for user inputed max numbers for guessing and is generally well functioning (except the playing again after a win). 

This 'reset' is basically the same as what happens after we win, right? Could there be a way to make this more DRY?