Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. def getTopRatedMovies (movies):
  2. top10 = []
  3. i = 1
  4. while i < len(movies):
  5. j = i
  6. while j > 0 and movies[j-1][1] < movies[j][1]:
  7. movies[j], movies[j-1] = movies[j-1], movies[j]
  8. j -= 1
  9. i += 1
  10. print (movies[0][0], ':', movies[0][1])
  11. print (movies[1][0], ':', movies[1][1])
  12. print (movies[2][0], ':', movies[2][1])
  13. for i in range(0,len(top10)):
  14. top10.append(movies[i])
  15. print (movies[i][1])
  16. return top10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement