Write a Python program to create a histogram from a given list of integers.

Write a Python program to create a histogram from a given list of integers.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def histogram( items ):
    for n in items:
        output = ''
        times = n
        while( times > 0 ):
          output += '*'
          times = times - 1
        print(output)

histogram([2, 3, 6, 5])

Final output

Leave a Comment