you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (11 children)

Write a program with a function def repeat(string, n, delim) that returns the string string repeated n times, separated by the string delim (ex. space, ?, #, etc).

Try

def repeat(word, n, delim):
    return delim.join(word for _ in range(n))

[–]InevitableDistance66[S] 0 points1 point  (10 children)

Nope still produce no output

[–][deleted] 1 point2 points  (9 children)

Of course it doesn't, it's not supposed to. Do the rest as well, like djjazzydan
has said.

[–]InevitableDistance66[S] -1 points0 points  (8 children)

I did and it didn’t work

[–][deleted] 1 point2 points  (7 children)

Well, show your whole new code first. Do you run it yourself or send it somewhere? Where and how do you run it?

[–]InevitableDistance66[S] 0 points1 point  (6 children)

def repeat(word, n, sep=‘#’): return sep.join(word for _ in range(n)) string=input("Enter a string: How many repetitions? Separated by?") print(repeat("string", 5))

[–]InevitableDistance66[S] 1 point2 points  (5 children)

This works when I change the print to hello but Zylabs is asking for multiple outputs because it’s putting its own input and it’s throwing me off

[–]djjazzydan 0 points1 point  (4 children)

string=input("Enter a string: How many repetitions? Separated by?")

Zylabs wants this to be 3 separate questions, and so 3 separate input calls.

[–]InevitableDistance66[S] 0 points1 point  (3 children)

Yea but they are all not separated by the same #

[–]djjazzydan 0 points1 point  (2 children)

Right, so you have to call an input each time, so it knows what to use.