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, 22.06.2019 20:00
What is used to analyze and summarize your data without graphical support
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 24.06.2019 02:00
Read the following scenario, and then answer the question below. you want to send an e-mail to your boss requesting a meeting to discuss a raise. what is the best example of an e-mail to an employer about this meeting? “hey jason. can we chat about getting me more money soon? let me know. peace, meg.” “hello jason. pardon me for sending yet another e-mail today about my need to talk to you about my position and a possible pay increase. i am dying to know when you can talk. sincerely, meg.” “hello jason. i have been with the company for one year and have taken on more responsibilities than outlined in my job description. i would appreciate an opportunity to speak with you about my position. let me know when we can schedule a meeting. you, meg.” “greetings jason! i hope this e-mail finds you well and happy today. i really, really want to talk to you about something important. i am not sure if you have time. i hope you do. get back in touch with me and let me know when we might talk. ever so much for taking the time to read this. sincerely, meg.”
Answers: 3
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
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
Chemistry, 08.12.2020 01:00
question
Mathematics, 08.12.2020 01:00
question
Mathematics, 08.12.2020 01:00
question
Physics, 08.12.2020 01:00
Questions on the website: 13722367