subject

Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half to do this. Each round you should roll two dice (Hint: use the randint function!), and print out their values. If the values on both dice are 1, then it is called snake eyes, and you should break out of the loop. You should also use a variable to keep track of how many rolls it takes to get snake eyes. Sample Run:

Rolled: 6 5
Rolled: 5 2
Rolled: 3 6
Rolled: 6 2
Rolled: 1 2
Rolled: 5 3
Rolled: 1 4
Rolled: 1 1
It took you 8 rolls to get snake eyes.

I have most of the code but when it prints it say you rolled 0 times every time.
import random

# Enter your code here

num_rolls = 0

import random
# Enter your code here

while True:

roll_one = random. randint(1,6)
roll_two = random. randint(1,6)
print ("Rolled: " +str(roll_one) +"," + str(roll_two))
if (roll_one == 1 and roll_two == 1):
print ("it took you " + str(num_rolls) + " rolls")
break

output:
Rolled: 3,5
Rolled: 6,4
Rolled: 2,4
Rolled: 3,6
Rolled: 5,2
Rolled: 1,1
it took you 0 rolls

suppose to say:
It took you (however many rolls) not 0

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
Data for which there is temporarily no room in ram is diverted to where on your computer? question 9 options: a) the paging file on the hard drive b) the system file on the hard drive c) the memory file on the hard drive d) the cpu cache
Answers: 2
question
Computers and Technology, 22.06.2019 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
You know the right answer?
Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half...
Questions
question
English, 18.09.2020 09:01
question
Geography, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Social Studies, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Biology, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
English, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Spanish, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
question
Mathematics, 18.09.2020 09:01
Questions on the website: 13722360