Last active
August 29, 2015 14:16
-
-
Save moisesnandres/a700ff3b61af6b3e94c5 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
import random | |
def lanzar_dado(): | |
return 1 + random.randrange(6) | |
def num_dados(n): | |
lista = [] | |
for i in range(n): | |
lista += [lanzar_dado()] | |
return lista | |
def escoger(): | |
preguntas = ['Primer número: ','Sumar el número: ','Restar el número: ','Multiplicar el número: ','Dividir el número: '] | |
return preguntas | |
def resultado(): | |
n = 5 | |
i = 0 | |
dados = num_dados(n) | |
pregunta = escoger() | |
while i < n: | |
print pregunta[i], dados[i] | |
i += 1 | |
resultado = dados[0] + dados[1] | |
resultado -= dados[2] | |
resultado *= dados[3] | |
resultado /= dados[4] | |
print "Obtuviste", resultado | |
resultado() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment