+ 2
Is there a better way to add a whole bunch of arguments?
9 Antworten
+ 5
outcomes = (list(product(dice,repeat =4)))
+ 3
You'd better review the lesson about loop at first.
+ 3
#maybe like this
multi = [list(dice) for i in range(4)]
res = product(*multi)
print(list(res))
+ 1
I'd like to keep trying and get back to you. I've messed with it so long my minds going completely blank. I've had every type error imaginable and embarrassingly enough, the only thing I can get to work is printing my answers multiple times 😅🥴
+ 1
Travis Beard This works? :-
print([(i, j) for i in range(1, 7) for j in range(1, 7)])
0
Originally i was just wondering if there was something I could add to line 4. Now im stuck trying to combine a for loop with "product". I definitely struggle with engineering code/combining things I've never seen together. I usually end up guessing and checking so much that by the time I get it, I end up with 20 incorrect solutions clouding out the 1 correct one in my brain which I fear hinders my retention.
0
The answer is simple, but it's not yours.
Thus, show the newest code of your solution.
0
Simba nice! Thanks! I knew there had to be a way to edit that line. 𝓕𝓛𝓨 I have no idea how to combine a loop and product. I was assuming a for loop but the closest I got were multiple outputs and it looked like I was getting close to even multiples of outputs. The only other thing I could come up with is maybe breaking everything down and writing like a whole page. I'm curious to see your solution now, and I'm curious if it uses 'memoization' (which I don't know much about) so it would have the memory to handle a 6 dice input.
- 1
Bro that's goo