Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # -*- coding: utf-8 -*-
- players=[]
- scores=[]
- def insertion_sort(arr, names):
- for i in range(len(arr)):
- cursor = arr[i]
- ncursor = names[i]
- pos = i
- while pos > 0 and arr[pos - 1] < cursor:
- arr[pos] = arr[pos - 1]
- names[pos] = names[pos - 1]
- pos = pos - 1
- arr[pos] = cursor
- names[pos] = ncursor
- return ([arr,names])
- for i in range(5):
- p=str(input('ΔΩΣΕ ΟΝΟΜΑ:'))
- players.append(p)
- s=int(input('ΔΩΣΕ SCORE:'))
- scores.append(s)
- result=insertion_sort(scores,players)
- scores=result[0]
- players=result[1]
- print (scores)
- print (players)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement