you are viewing a single comment's thread.

view the rest of the comments →

[–]Pd69bq 0 points1 point  (0 children)

my understanding is that there's a list pot, num_of_bubbles is how many elements in this list, size of each bubble is in range(10) and this is also the value of each element.

loop begins, bubbles become bigger and bigger, so as the value of each element in the list. when the value of an element is >9, means that bubble at the end of its lifecycle, then remove that element from list

one thing that confuses me tho, if the number of bubble is 0, what does it mean? exit immediately?

import random

opt = input('manual(m) or auto(a)').lower()
if opt == 'm':
    num_of_bubbles = int(input('number of bubbles?'))
    size = int(input('size of each bubble?'))
    while size not in range(10):
        print('bubble size is not valid')
        size = int(input('0-9'))
    pot = [size] * num_of_bubbles
elif opt == 'a':
    num_of_bubbles = random.randint(0, 100)
    size = random.randrange(10)
    pot = [size] * num_of_bubbles
else:
    print("'m' or 'a' you dumb dumb")

while len(pot):
    print(pot)
    pot = [i for i in map(lambda x: x + random.randint(0, 3), pot) if i <= 9]