Created
December 4, 2009 16:54
-
-
Save lvidarte/249151 to your computer and use it in GitHub Desktop.
aprendiendo a multiplicar
This file contains hidden or 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sys, random | |
if len(sys.argv) > 1 and int(sys.argv[1]) > 0: | |
base = int(sys.argv[1]) | |
else: | |
base = 0 | |
ok = [ | |
'felicitaciones!', | |
'buenísimooo', | |
'sos buena eh!', | |
'esa era re-fácil!', | |
'no esta mal...', | |
'tu memoria me asombra!', | |
'que inteligenteeeee', | |
'bah, esa la hace cualquiera...', | |
'excelente!', | |
'bue, si no hacías esa...', | |
'que genia!', | |
':-)' | |
] | |
error = [ | |
'si si... y los chanchos vuelan...', | |
'segui participandoooo', | |
'asi vamos mal, eh...', | |
'errar es humano!', | |
'grrr, mal', | |
'uy, eso es grave!', | |
'juajua, metiste la pata', | |
'hasta mushu sabia esa!!' | |
] | |
bye = [ | |
'chauchis!', | |
'nos vemos!', | |
'uf, yo tambien me canse... chau' | |
] | |
user_result = 1 | |
points = 0 | |
last = 1 | |
print "APRENDIENDO LAS TABLAS" | |
print "(ingresá cero para terminar)" | |
while user_result > 0: | |
if last == 1: | |
if base > 0: x = base | |
else: x = random.randint(1,10) | |
y = random.randint(1,10) | |
result = x*y | |
print x, " * ", y, " = ", | |
user_result = int(raw_input()) | |
if (user_result == 0): | |
print bye[random.randint(0, len(bye)-1)] | |
elif (user_result == result): | |
last = 1 | |
points = points + result | |
print "correcto:", ok[random.randint(0, len(ok)-1)] | |
else: | |
last = 0 | |
points = points - result | |
print "incorrecto:", error[random.randint(0, len(error)-1)] | |
print "puntaje:", points |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment