def bubble_sort(arr):

for i in range(len(arr)-1):

for j in range(i+1, len(arr)):

if arr[i][1] < arr[j][1]:

arr[i], arr[j] = arr[j], arr[i]

return arr

Election = {'Abdul':500, 'Mohan':395, 'Amir':800, 'Atishi':1000, 'Gautam':900}

e = bubble_sort(list(Election.items())) # Election.items() returns a list of tuples with each tuple being key:value pair from the dictionary

A1 = [e[i][0] for i in range(len(e))] # list of names

B1 = [e[i][1] for i in range(len(e))] # list of votes

for i in range(len(e)):

print(A1[i], B1[i])

# Output

Atishi 1000

Gautam 900

Amir 800

Abdul 500

Mohan 395