How to bulk rename objects within a target collection? I have hundreds of objects within a collection (Blender 2.8) and would like to avoid manually renaming each object via the UI. I'm new to Blender and noticed there is scripting support. Could anyone help me produce a script to rename my objects?

For example, I would like to rename the objects in my "Water" collection. The current names do not follow a well defined pattern (even though the screenshot may make it look that way). When renaming is done, I do not care about retaining any semblance of the current name. My only requirement is adding a custom prefix. I'm envisioning the renaming to result in object names like: Water1, Water2, etc.
Iterate over collection objects.

This example is a reasonably simple introduction into scripting blender's python API.

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(wcol.objects):
        o.name = "Water%d" % i


To ensure they keep their previous name order, and to have "Water1" first rather than "Water0"

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(sorted(wcol.objects[:], key=lambda o: o.name)):
        o.name = "Water%d" % (i + 1) # to start from 1