Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+4 votes

I tried def drawBarGraph([]):
but its giving me an error

asked in CSC201 Spring 2021 by (132 points)

After defining the list, how do you get the asterik to print for each element?


You'll use string multiplication based on each value. So like, "v" * value, if value = 5, would print vvvvv, five vs.

2 Answers

+4 votes

Think of it as a normal variable because defined function takes whatever you give it in the call statement. So just do drawBarGraph(yourList):

answered by (8 points)
+3 votes

You'll want to put the name of a list you define in your main function in the parentheses, like: drawBarGraph(listName):
Then go and define listName in your main, before you call drawBarGraph.

answered by (337 points)