Rolling Dice CodeHS. Please help :)
Hello Repel community,
I am stuck on a CodeHS question titled: Rolling Dice. Can you guys please help me with this, it means the world to me, thank you <3
Here is the problem :)
Write a python program that will print out all combinations that can be made when 2 dice are rolled.
Your output should look like this:
And should continue until all values up to 6, 6 are printed. (Hint: You should have a space after each comma!)
Because you know exactly how many times each loop should iterate, you should use nested for loops (a loop within a loop) to complete this program.
@LostWonderer found the solution, I am not going to tell you the code just some hints so that you will learn it not just copy (you can check your answer with the one on my profile named CodeHS) so you should make a list with numbers (in string form) 1 through 6 in order of least to greatest, so now how will you get it to print all the pairs all you will need to do is loop through the list multiple times printing the two roles with a for loop.
AKA: make a list containing
["1","2","3","4","5","6"] then have one for loop running around the list, then another for loop inside now it should run through all the solutions, the final problem is to just print it assuming the first for loop uses I and the second uses j you just need to print a combination of
, , and
j then just print the output of that
EDIT: you can check the code here