How to print patterns in python : I want to print a pattern from a group of numbers which denotes the direction of flow?

0 - north
1 - north east
2 - east
3 - south east
4 - south
5 - south west
6 - west
7 - north west

if 424222006 is the given number, then according to direction i have to print as shown below

The required output should be according to directions.

0 * * 0 0

0 0 * * 0

* 0 0 0 0

Can someone please help me with this