Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+4 votes

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

asked in CSC201 Spring 2021 by (1 point)
0

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

0

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 (1 point)
+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 (1 point)
...