Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created April 5, 2018 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/f34a78731cbb72959284438a70ab65e8 to your computer and use it in GitHub Desktop.
Save Fhernd/f34a78731cbb72959284438a70ab65e8 to your computer and use it in GitHub Desktop.
Transformación y reducción de datos. OrtizOL.
numeros = [2, 3, 5, 7, 11, 13]
suma_cuadrados = sum(numero * numero for numero in numeros)
print(suma_cuadrados)
print('')
# Comprueba si existen archivos Python
# en un directorio dado:
import os
archivos = os.listdir('/usr/lib/python3.5/')
if(any(nombre.endswith('.py') for nombre in archivos)):
print('Existen archivos Python en el directorio dado.')
else:
print('No existen archivos Python en el directorio dado.')
print('')
datos = ('Python', 3.5, 'x64')
print(','.join(str(elemento) for elemento in datos))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment