Advertisement
Guest User

pretty print

a guest
Oct 30th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def pretty_print(assignment):
  2. for i in range(9):
  3. output = ''
  4. for j in range(9):
  5. values = assignment[str(i) + "-" + str(j)]
  6. if len(values) == 1:
  7. output += " " + values[0] + " "
  8. else:
  9. output += " "
  10.  
  11. if j == 2 or j == 5:
  12. output += "|"
  13. print output
  14. if i == 2 or i == 5:
  15. print '---------+---------+---------'
  16. print " "
  17. print " "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement