# Ejercicio138-139v1

user_9823623288
python
3 years ago
2.4 kB
78
Indexable
Never
```# -*- coding: utf-8 -*-
"""
Created on Fri Oct 15 08:53:40 2021

@author: Quiubs
"""
import random
#tarjetaBingo = {'B':[0-15], 'I':[16-30], 'N':[31-45],
#                'G':[46-60], 'O':[61-75]}

tarjetaBingoRangos = {'B':range(1,16),
'I':range(16,31),
'N':range(31,46),
'G':range(46,61),
'O':range(61,76)}

def genera5NumEnRango(num_ini, num_fin):
listaNum = []
random.randint(num_ini, num_fin)
while (len(listaNum) < 5):
numAleatorio = random.randint(num_ini, num_fin)
if not numAleatorio in listaNum:
listaNum.append(numAleatorio)

return listaNum

def generaTarjetaBingo():
tarjetaBingo = {}
tarjetaBingo['B'] = genera5NumEnRango(1,15)
tarjetaBingo['I'] = genera5NumEnRango(16,30)
tarjetaBingo['N'] = genera5NumEnRango(31,45)
tarjetaBingo['G'] = genera5NumEnRango(46,60)
tarjetaBingo['O'] = genera5NumEnRango(61,75)

return tarjetaBingo

def impTarjetaBingo(tarjetaBingo):
print ("B\tI\tN\tG\tO")
for index in range(0,5):

def verificaTarjetaBingo(tarjetaBingo):
for key in tarjetaBingo:
if len(tarjetaBingo[key]) != 5:
return False
for ele in tarjetaBingo[key]:
if not ele in tarjetaBingoRangos[key]:
return False
for ele in tarjetaBingo[key]:
return False
else:

return True