Advertisement
Fhernd

reduccion-transformacion.py

Apr 5th, 2018
2,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. numeros = [2, 3, 5, 7, 11, 13]
  2.  
  3. suma_cuadrados = sum(numero * numero for numero in numeros)
  4.  
  5. print(suma_cuadrados)
  6.  
  7. print('')
  8.  
  9. # Comprueba si existen archivos Python
  10. # en un directorio dado:
  11. import os
  12.  
  13. archivos = os.listdir('/usr/lib/python3.5/')
  14.  
  15. if(any(nombre.endswith('.py') for nombre in archivos)):
  16.     print('Existen archivos Python en el directorio dado.')
  17. else:
  18.     print('No existen archivos Python en el directorio dado.')
  19.    
  20. print('')
  21.  
  22. datos = ('Python', 3.5, 'x64')
  23. print(','.join(str(elemento) for elemento in datos))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement