Duplicate a mesh via python
Another take

Before closing as dupe, thought I would put together another take on this for example sake.

Added a method that simply yields n copies of the given object with a new name and suffix.  If linked is False the object copies all share the same mesh.

import bpy
from bpy import context 

def object_duper(ob, name, n=1, linked=False):
    assert(ob)
    for i in range(n):
        copy = ob.copy()
        if ob.data and linked:
            copy.data = copy.data.copy()
        copy.name = f"{name}_{i + 1}"
        yield copy

# testing

ob = context.object

for o in object_duper(ob, ob.name, 5):
    context.scene.collection.objects.link(o)


This method simply dupes the objects which will naturally be added to bpy.data.objects collection. I have not put in the link to collection.  Could emulate your answer method with, and pass the collection

def dupe_n_link(collection, ob, name, n=1, linked=False):
    for o in object_duper(ob, name, n=n, linked=linked):
        collection.objects.link(o)


Can think of many reasons to create multiple duplicates, may not always wish  to add all dupes to same collection, may wish to add one to each collection

ob = context.object

colls = bpy.data.collections

for c, o in zip(colls, object_duper(ob, "Basis", n=len(colls))):
    c.objects.link(o)