Minor changes

1. Changed the algo for degree
2. Moved break statement
3. Used poly.as_dict() instead of separatevars
4. Changed dict comprehension