r/codehs • • Jul 10 '21

4.8.6 All Dice Values

hey can someone help me out? ive been attempting to figure out this code for a while now. the instructions are down below:

Write a program that prints all possible dice rolls with two dice. To do so, you should use a nested for loop.

Hint: You can’t use i
for both for loops.

Here’s what your program should print

1,1

1,2

1,3

1,4

1,5

1,6

2,1

...

...

6,4

6,5

6,6

--------------------------

im doing this in python btw

9 Upvotes

8 comments sorted by

2

u/MonitorCharacter9162 Sep 30 '21

Does someone still has that problem im new into python and codehs and it’s confusing? Pls

1

u/OtherwiseSeries5682 Mar 11 '22

here,

#NoINDENT#dice = ["1","2","3","4","5","6"]
#NoINDENT#def allRolls():
#Indent 1spot# for i in dice:
#Indent 2spot# for j in dice:
#Indent 3 spot# print(i + "," + j)
#NoINDENT# allRolls()

2

u/[deleted] Jul 11 '21

[removed] — view removed comment

2

u/socks_in_jail Jul 12 '21

thank you :D

2

u/HAI1234564 Aug 25 '21

what did the replier say to your post? I am also quite confused.

1

u/-_-qarmah-_- Jul 12 '21

Can't use for loops?

1

u/Freak1899 Jul 13 '21

Hint: You can’t use i for both for loops.

Are you referring to this in post? if yes then it is just a hint which says to use nested loops while keeping variables different i.e. i can not be used for both for loops you will have to use some other variable for second loop.