6.5k views
2 votes
Write the definition of a method, dashedline, with one parameter, an int. if the parameter is negative or zero, the method does nothing. otherwise it prints a complete line terminated by a newline to standard output consisting of dashes (hyphens) with the parameter's value determining the number of dashes. the method returns nothing.

User Jayvee
by
5.8k points

1 Answer

1 vote
# python 3.x
def dashedline(int n):
if n > 0:
print('-' * n)


If you wanted a different language, you should make sure to specify that in your question.
User Yannick Pezeu
by
6.3k points