Avdluna

velhos

Dec 14th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. # coding: utf-8
  2. # Mais Velhos Primeiro
  3. # Amanda Luna [116210896] / UFCG
  4.  
  5. def fila(lista) :
  6.     a=0
  7.    
  8.     for i in range(len(lista)) :
  9.         if lista[i] >= 60 :
  10.             pessoa = lista[a]
  11.             lista[a] = lista[i]
  12.             lista[i] = pessoa
  13.             a += 1
  14.            
  15.     print lista
  16.  
  17. lista = [25, 33, 67, 61, 35, 8, 12, 15, 22, 63, 75, 30, 34]
  18. fila(lista)
  19. assert lista == [67, 61, 63, 75, 35, 8, 12, 15, 22, 25, 33, 30, 34]
Add Comment
Please, Sign In to add comment