Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

**** CREATE A PYTHON PROGRAM **** You are playing a dice game. You roll a single

ID: 3603797 • Letter: #

Question

**** CREATE A PYTHON PROGRAM ****
You are playing a dice game. You roll a single dice six times. The best possible score would be to roll all the numbers 1 through 6 within those six dice rolls. You get one point for each number in a sequence. You must roll a 1 to start the sequence otherwise you will receive zero points for that round.
**** This program must contain 2 loops and an IF structure. This program is an example of sequencing. ****
# You will need to generate a random number between 1 and 6 for each of the six dice rolls.

THIS IS AN EXAMLE OF THE DESIRED OUTPUT:
You have rolled
1 3 2 3 6 6 #Randomly generated numbers
------------------------------
Verifying Sequence
roll 1 = 1
roll 3 = 2
roll 2 = 3
------------------------------
Score = 3 #one point per correct sequence
Total Score = 3
Enter 'quit' to end:


You have rolled
4 3 2 5 6 6 #Randomly generated numbers
------------------------------
Verifying Sequence
0 points no sequence
------------------------------
Score = 0 #one point per correct sequence
Total Score = 3
Enter 'quit' to end:


You have rolled
4 1 2 3 2 5 #Randomly generated numbers
------------------------------
Verifying Sequence
roll 2 = 1
roll 3 = 2
roll 4 = 3
roll 1 = 4
roll 6 = 5
------------------------------
Score = 5 #one point per correct sequence
Total Score = 8
Enter 'quit' to end:

Explanation / Answer

import random , sys
mylist = [0,0,0,0,0,0]
totalscore = 0
while(1):
for i in range(0,6):
mylist[i]=random.randint(1, 6)
print("You have rolled")
for i in range(0,6):
print(mylist[i])
score = 0
print("#Randomly generated numbers")
print("--------------------")
print("Verifying sequence")
for i in range(0,6):
flag = False
for j in range(0,6):
if(mylist[j]==(i+1)):
score = score + 1
print "roll",(j+1)," = ",i
flag = True
break
if(flag == False):
break
if(score == 0):
print("0 points no sequence")
print("--------------------")
print "Score = ",score
totalscore = totalscore + score
print "Total Score = ", totalscore
ch = str(raw_input("Enter quit to end: "))
if(ch=="quit"):
sys.exit(0)
  

OUTPUT