Home/Support/Support Forum/How to make multiple copies, of printed range functions that are on one line
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to make multiple copies, of printed range functions that are on one line

0 votes
Very new to python so please excuse!

question is...to make an output look like

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

I am using user input for the limit and the number of copies ( in this example 5 and 3), so I have done this;

limit = int(input("Select upper limit"))
copies = int(input("Select number of copies"))


def output(limit):
for i in range(copies):
for x in range(limit):
print (x + 1, end=" ")


output(limit)

However the answer shows up as 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5. I know it's because of the end=" " but not sure how to get around it! Any help appreciated
asked Apr 19, 2015 in Python by Amateur Ayers New to the Community (0 points)

Please log in or register to answer this question.

...