+ 2

Is there a better way to add a whole bunch of arguments?

https://code.sololearn.com/cpHfIxV7olG9/?ref=app

13th Jan 2022, 10:22 AM
Travis Beard
Travis Beard - avatar
9 Antworten
+ 5
outcomes = (list(product(dice,repeat =4)))
13th Jan 2022, 12:27 PM
Simba
Simba - avatar
+ 3
You'd better review the lesson about loop at first.
13th Jan 2022, 10:36 AM
FanYu
FanYu - avatar
+ 3
#maybe like this multi = [list(dice) for i in range(4)] res = product(*multi) print(list(res))
13th Jan 2022, 1:28 PM
Simba
Simba - avatar
+ 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 😅🥴
13th Jan 2022, 12:10 PM
Travis Beard
Travis Beard - avatar
+ 1
Travis Beard This works? :- print([(i, j) for i in range(1, 7) for j in range(1, 7)])
13th Jan 2022, 4:49 PM
Œ ㅤ
Œ ㅤ - avatar
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.
13th Jan 2022, 11:51 AM
Travis Beard
Travis Beard - avatar
0
The answer is simple, but it's not yours. Thus, show the newest code of your solution.
13th Jan 2022, 12:02 PM
FanYu
FanYu - avatar
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.
13th Jan 2022, 1:01 PM
Travis Beard
Travis Beard - avatar
- 1
Bro that's goo
14th Jan 2022, 5:53 PM
Kuot Jackson
Kuot Jackson - avatar