def get_leaderboard(): data = get_leaderboards().json categories = data['leaderboards'] daiy_leaderboards = categories['daily'] for i in daiy_leaderboards: print( f" {i['rank']} | Username = {i['username']} | Score = {i['score']}" )
def print_leaderboards(): data = get_leaderboards().json categories = data.keys() for category in categories: print('Category:', category) for idx, entry in enumerate(data[category]): print( f'Rank: {idx + 1} | Username: {entry["username"]} | Rating: {entry["score"]}' )
def print_leaderboards(): data = get_leaderboards().json['leaderboards'] categories = data.keys() for category in categories: print('Category:', category) for idx, entry in enumerate(data[category]): print( f"Rank: {idx + 1} | Username: {entry['username']} | Rating: {entry['score']}" )
def get_leaderboard(category: "blitz"): category = leaderboards_key(category) data = get_leaderboards().json leaderboard = { #the dictionary where the information of the top 50 users of that category will be stored } for idx, entry in enumerate(data[category]): username = f'{entry["username"]}' score = f'{entry["score"]}' leaderboard[idx + 1] = [username, score] return leaderboard
def print_leaderboards(): #makes a data vairable for the data data = get_leaderboards().json #another variable for the data keys i think. categories = data.keys() #prints categorie for category in categories: print('Category:', category) for idx, entry in enumerate(data[category]): print( f'Rank: {idx + 1} | Username: {entry["username"]} | Rating: {entry["score"]}' )
def print_leaderboards(): data = get_leaderboards().json # printer.pprint(data.json) # print(data.json['leaderboards']['daily']) categories = data['leaderboards'].keys() for category in categories: print('Category:', category) for idx, entry in enumerate(data['leaderboards'][category]): # print(entry) print( f'Rank: {idx + 1} | Username: {entry["username"]} | Rating: {entry["score"]}' )
async def print_leaderboards(self, ctx): await ctx.send("Leaderboards") data = chess.get_leaderboards().json categories = data.keys() for category in categories: await ctx.send('Category:' + str(category)) for idx, entry in enumerate(data[category]): if idx < 3: await ctx.send( f'Rank: {idx + 1} | Username: {entry["username"]} | Rating: {entry["score"]}' ) else: break