samedi 12 novembre 2016

How do you get a loop to stop when an array runs out of values in python?

I am working on a game of bingo for which I am using an array with 75 numbers. After rolling a number the code will remove it. I want to stop rolling numbers when there are no numbers left in the array.

So far I have this:

import random
numbers=[]
number=1
for i in range (0,75):
    numbers.append(number)
    number=number+1

How do I get the code to stop rolling a number when the array runs out of numbers?




Aucun commentaire:

Enregistrer un commentaire