So I've got a Discord bot that will load information about a user's personal charts and display it to them, and one of the commands is to get their leaderboard and show them the most successful songs on their charts. It does this by creating different pages in the embed, and the user can press the reactions to change pages. However, when it comes to generating the embed for each page, I feel like the code I'm using is very messy and could be done in a loop instead, but I'm just not quite sure how to do that, so I'd much appreciate some feedback.
description = []
for i, _ in enumerate(song_name): #song_name is a list of the names of all the songs on the leaderboard
if i >= 0 and i < 10:
try:
description[0] = description[0] + "\n" + str(i+1) + ". **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)"
except IndexError:
description.append("1. **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)")
if i >= 10 and i < 20:
try:
description[1] = description[1] + "\n" + str(i+1) + ". **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)"
except IndexError:
description.append("11. **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)")
if i >= 20 and i < 30:
try:
description[2] = description[2] + "\n" + str(i+1) + ". **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)"
except IndexError:
description.append("21. **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)")
if i >= 30 and i < 40:
try:
description[3] = description[3] + "\n" + str(i+1) + ". **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)"
except IndexError:
description.append("31. **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)")
if i >= 40 and i < 50:
try:
description[4] = description[4] + "\n" + str(i+1) + ". **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)"
except IndexError:
description.append("41. **" + song_artists[i] + "** - **[" + song_name[i] + "](" + song_link[i] + ")** (" + f"{int(song_points[i]):,}" + " points)")