Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

def pagination():

        pagination = range(1, 5)

        for p in pagination:

            page = f"https://www.xx.xx{p}"

            return (page)

when I call a method it doesn't loop and It only returns the line https://www.xx.xx1

1 Answer

0 votes
by (36.8k points)

Return stops using the whole function, therefore loop is immediately terminated. Try using the list and appending at the end, you can return this list.

If you are a beginner and want to know more about Data Science the do check out the Data Science course

Browse Categories

...