就是把用户输入的 list 里的数字转换成 x 数量的星号。目前卡在两个地方 1.input ()命令可以输入 list 吗? 2. 可以直接用加减乘除来打印出相对应数量的星号吗? 感谢
Problem 2: Write a function that takes a list of numbers as parameters. Then print a histogram based on those numbers. Use asterisks to draw the histogram. For example, given the list [3, 7, 9, 5]. The function should produce the following:
*** ******* ********* *****
Call the function with the list [3, 7, 9, 5]. Then call the function with the list [2, 0, 1].
Hint: List was covered in the A3 notebook. We will formally discuss list in A5 notebook. You might want to first write the histogram code without a function. Then after code is working, write the code with a function. Please submit only the code with a function.