Advertisement
GastonPalazzo

Bucles_1 - Ej-6

Aug 31st, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. #funciones
  2. def inversa(l):
  3.     tipo=type(l)
  4.     temp=[]
  5.     for i in l:
  6.         temp.insert(0, i)
  7.     temp
  8.     if tipo == str:
  9.         temp=''
  10.         for i in l:
  11.             temp+=i
  12.         temp
  13.     return temp
  14.  
  15. #main
  16. print('\n|Ej 6|')
  17.  
  18. listaNum=[1, 2, 3, 4, 5, 6]
  19. print(f'\nInversa de lista numerica ({listaNum}) -> {inversa(listaNum)}')
  20.  
  21. cadena='Gaston'
  22. print(f'\nInversa de string ({cadena}) -> {inversa(cadena)}')
  23.  
  24. print('\nFin de la ejecucion!\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement