Histogram Program



I want to make a Python program that prints an amount of *'s based on a list. So if a list was numlist = [2,5,3,6] it would output:


I also want to use a function to do this, here is my code:

def histogram(numlist):
    for num in numlist:

numlist = [2,5,3,6]

I left the print blank because that is the part I am having trouble on.


This is the most interesting part :slightly_smiling:

What did you think about trying and how did that turn out?


Well I tried print('*'[numlist] but it gave the error

  File "/Users/eric/Desktop/histogramEric.py", line 12, in <module>
  File "/Users/eric/Desktop/histogramEric.py", line 9, in histogram
IndexError: string index out of range


Think about how '*' and num could form the output that you want.

Did you know that you can multiply a string by a number?



Was thinking about that but didn't know that it was possible.