Advertisement
Avdluna

Untitled

Jan 16th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. # coding: utf-8
  2. # Números Oscilantes
  3. # Amanda Luna [116210896] / UFCG
  4.  
  5. def oscilantes(cod) :
  6.    
  7.     condicao = False
  8.     list(cod)
  9.    
  10.     for i in range(len(cod)-1) :
  11.        
  12.         if cod[i]%2 == 0 and cod[i+1]%2 != 0 or cod[i]%2 != 0 and cod[i+1]%2 == 0 :
  13.             condicao = True
  14.            
  15.     return condicao
  16.  
  17. codigo = raw_input().split()
  18.  
  19. oscilantes(codigo)
  20.  
  21. qtd = len(codigo)
  22.  
  23. if condicao :
  24.     print "Verdadeiro: %d" % qtd
  25.    
  26. else :
  27.     print "Falso: %d" % qtd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement