Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Thu Dec 5 11:40:57 2019
- @author: dario
- """
- import random
- #album = [0,0,0,0,0,0,0,0,0,0]
- #figuritas_sacadas=0
- #
- #while 0 in album:
- # figurita = random.randint(0,9)
- # album[figurita] = 1
- #
- # figuritas_sacadas = figuritas_sacadas + 1
- def comprar_una_figu(figus_total):
- return random.randint(0, figus_total-1)
- def esta_lleno(album):
- return not (0 in album)
- def cuantas_figus(figus_total):
- album = []
- i = 0
- while i < figus_total:
- album.append(0)
- i=i+1
- contador = 0
- while not(esta_lleno(album)):
- figu = comprar_una_figu(figus_total)
- album[figu] = 1
- contador = contador + 1
- return contador
- res = cuantas_figus(6)
- print("Necesitamos", res, "figus para completar")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement