Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. listanum = []
  2. num = 1
  3.  
  4.  
  5. def calculo():
  6.     while num != 0:
  7.         num = int(input("digite a sequencia de números: (termine com zero) "))
  8.         listanum.append(num)   #append adiciona o valor ao fim da variável
  9.  
  10.     #-1 pq o vetor sempre começa no zero, mas a contagem começa em 1.
  11.     tam = len(listanum) -1
  12.  
  13. def inversao():
  14.     while tam >= 0:
  15.         print(listanum[tam], end=", ")
  16.         tam = tam -1
  17.  
  18.  
  19.    
  20. calculo()
  21. inversao()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement