Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

relative ranks in python

def findRelativeRanks(score):
    copy_ver = score.copy()
    sorted_score = sorted(copy_ver, reverse=True)

    empty = {}
    for a,b in enumerate(sorted_score,1):
        empty[b] = str(a)

        if empty[b] == "1":
            empty[b] = "Gold Medal"
        if empty[b] == "2":
            empty[b] = "Silver Medal"
        if empty[b] == "3":
            empty[b] = "Bronze Medal"

    last = []
    for i in score:
        last.append(empty[i])

    return last
Comment

PREVIOUS NEXT
Code Example
Python :: python denest list of anything 
Python :: yml file for django 
Python :: print backward number from input 
Python :: gensim loop through models 
Python :: updating lists 
Python :: handling files in django 
Python :: running setup.py install for rjsmin ... error 
Python :: Example of inheritance and constructor in subclass 
Python :: pyhton transpose without changing column and row names 
Python :: property values 
Python :: airflow get execution context dictionary kubernetes pod name 
Python :: python convert docx to pdf linux 
Python :: sum function in python 
Python :: benifits fo nested classes in python 
Python :: python using recursion advanced 
Python :: Find Resolution of JPEG Image 
Python :: django create view template 
Python :: django command to fetch all columns of a table 
Python :: looping over folder to extract zip winrar python 
Python :: isat in panadas datframe 
Python :: draw networkx graph using plt.pause 
Python :: pandas map 
Python :: pip unknown command import 
Python :: dictionnaire 
Python :: print class name python 
Python :: how to call a function in python? 
Python :: Python Getting back to Decorators 
Python :: encrypt 
Python :: Fill area under line plot 
Python :: assemblyai 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =