Created
January 23, 2012 23:57
-
-
Save gcorreaq/1666599 to your computer and use it in GitHub Desktop.
Código para corregir control 4 del ramo "Programación", 2011-2 USM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python prueba_control_4.py RUT.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Este archivo es solo para probar las funciones del control 4 | |
import sys | |
def main(): | |
# Si viene un argumento, se asume que es el nombre de un archivo | |
if len(sys.argv) > 1: | |
import_name = sys.argv[1] | |
# Se importa, omitiendo la extension del archivo | |
# De aqui en adelante, se ocupa 'modulo' como nombre de referencia para este modulo | |
modulo = __import__(import_name[:len(import_name) - 3]) | |
else: | |
print "ERROR" | |
return | |
# Prueba de suma de digitos | |
print "-- Suma de digitos --" | |
numero = int(raw_input("Numero: ")) | |
print modulo.suma_digitos(numero) | |
# Prueba de reducir a digito | |
print "-- Reducir a digito --" | |
numero = int(raw_input("Numero: ")) | |
print modulo.reducir_a_digito(numero) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment