Advertisement
LightProgrammer000

Invertendo sequencia [python 3]

Feb 20th, 2020
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. '''
  2. Programa: Invertendo sequência
  3. '''
  4.  
  5. # Principal
  6. def main():
  7.  
  8.     # Variavel
  9.     ctrl = True
  10.     lista = []
  11.  
  12.     # Estrutura de repeticao
  13.     while ctrl:
  14.  
  15.         # Chamada de metodo
  16.         a = ent_dad()
  17.  
  18.         # Estrutura de decisao
  19.         if a == 0:
  20.             ctrl = False
  21.  
  22.         else:
  23.  
  24.             # Incluir na lista
  25.             lista.append(a)
  26.  
  27.     # Estrutura de repeticao
  28.     print("")
  29.     for i in range((len(lista) - 1), -1, -1):
  30.         print(lista[i])
  31.  
  32. # Metodo: Maior elemento
  33. def ent_dad():
  34.  
  35.     # Entrada de dados
  36.     num = int(input("Digite um número:"))
  37.  
  38.     return num
  39.  
  40. # Execucao
  41. if __name__ == '__main__':
  42.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement