Hint: what you want to do is a very simple version of a histogram: https://en.wikipedia.org/wiki/Histogram

Hint: the number of dots and the number of lines are a function of a related loop...