Dice Rolling (with curses library)

Modify curses_3.py (shown below) so that in addition to the counting number, in the same row you also display a bar (e.g. "******") to show the same number of stars.


import random
import time
import curses

stdscr = curses.initscr()

a = [0] * 6
for i in range(6):
    stdscr.addstr( "{0} (  )\n".format(i+1) )

for i in range(10):
    j = random.randint(0,5)
    stdscr.move(10, i*2)
    stdscr.addstr( "{0:2}".format(j+1) )
    a[j] = a[j] + 1
    stdscr.move(j, 3)
    stdscr.addstr("{0:2}".format( a[j] ) )
    stdscr.refresh()
    time.sleep(2)

curses.endwin()