fork download
  1. def mostra_array(array, texto):
  2. for posicao, num in enumerate(array):
  3. print("{}[{}] = {}".format(texto, posicao, num))
  4.  
  5. pares= []
  6. impares= []
  7.  
  8. for i in range(15):
  9.  
  10. n= int(input())
  11. if n%2==0:
  12. pares.append(n)
  13. if len(pares) == 5:
  14. mostra_array(pares, "par")
  15. pares = []
  16.  
  17. if n%2!=0:
  18. impares.append(n)
  19. if len(impares) == 5:
  20. mostra_array(impares, "impar")
  21. impares = []
  22.  
  23. mostra_array(impares, "impar")
  24. mostra_array(impares, "par")
  25.  
  26.  
Success #stdin #stdout 0.01s 27656KB
stdin
10
20
30
40
50
-10
-20
-30
-40
-50
12
14
16
18
20
stdout
par[0] = 10
par[1] = 20
par[2] = 30
par[3] = 40
par[4] = 50
par[0] = -10
par[1] = -20
par[2] = -30
par[3] = -40
par[4] = -50
par[0] = 12
par[1] = 14
par[2] = 16
par[3] = 18
par[4] = 20