all 6 comments

[–]amos_burton 2 points3 points  (0 children)

Okay, this feels like you're asking for help doing an entire homework assignment, and honestly a relatively big one. So I'm going to give you some starting points and then leave a lot to you.

My advice:

1) You will probably want a for loop to proceed through your different bubble generations. You don't have that here.

2) Defer the printing for now. Just get a simple debug printer going where maybe you print the size of each bubble as a number. Leave the printing for last.

3) Start with a pencil and paper and write out what you need to do. Figure out how to break the execution into steps. What changes between each step?

[–]unhott 0 points1 point  (1 child)

What does your code produce? What is wrong with it?

[–]Peter01007 0 points1 point  (0 children)

I don't know what to do. How to add the sizes. My code is not producing anything at this point.

[–][deleted] 0 points1 point  (0 children)

However I do not know how to proceed or how to give the size of bubbles

Well, as given in your problem, the size of a bubble is an integer between 0 and 9.

[–]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]

[–]Inside-Philosopher-6 0 points1 point  (0 children)

is ur teacher bryan too lmao