1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
34kurt
3 years ago
10

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
Computers and Technology
1 answer:
marishachu [46]3 years ago
4 0

import random

num_rolls = 0

while True:

   r1 = random.randint(1, 6)

   r2 = random.randint(1, 6)

   print("Rolled: " + str(r1) + "," + str(r2))

   num_rolls += 1

   if r1 == r2 == 1:

       break

print("It took you "+str(num_rolls)+" rolls")

I added the working code. You don't appear to be adding to num_rolls at all. I wrote my code in python 3.8. I hope this helps.

You might be interested in
Choose the parts of the browser window.
8_murik_8 [283]

Answer:

The answer is "Title bar".

Explanation:

The title bar is located on top of the screen, its color blue, which is used in browsers. It has the function, that shows the title of the web page, that you currently viewing, and other choices were wrong, which can be described as follows:

  • Enter bar is the wrong option because it is not a part of the browser.
  • The back button is also known as a backspace key which is used to delete so thing, which is written by keyboard, that's why it is wrong.
  • The forward bar is used in pipe in a module that's why it's incorrect.

4 0
3 years ago
Which relationship is possible when two tables share the same primary key?
klasskru [66]

Answer:

Many-to-one

Explanation:

Many-to-one relationships is possible when two tables share the same primary key it is because one entity contains values that refer to another entity that has unique values. It often enforced by primary key relationships, and the relationships typically are between fact and dimension tables and between levels in a hierarchy.

6 0
3 years ago
What will be the answer?
Usimov [2.4K]

Answer:

NumPy

Explanation:

6 0
3 years ago
Read 2 more answers
HEYYY! you're probably a really fast typer can you please type this for me! i tried copying and pasting it but it wouldn't let m
gladu [14]

Answer:

here you go. wish you a great day tomorrow.

and in fact,computer science is somewhat the right category

Abstract art may be - and may seem like - almost anything. This because, unlike the painter or artist who can consider how best they can convey their mind using colour or sculptural materials and techniques. The conceptual artist uses whatever materials and whatever form is most suited to putting their mind across - that would be anything from the presentation to a written statement. Although there is no one kind or structure employed by abstract artists, from the late 1960s specific tendencies emerged.

5 0
3 years ago
Elena is working on a team project for her computer science class. Although the entire team is responsible for the project, some
Angelina_Jolie [31]

Answer:

It is because of a phenomenon called Social Loafing.

Explanation:

In social psychology, social loafing is when someone normally performs an activity with great effort and energy, but when is working in a group this effort is reduced to the minimum. These students maybe could be able to perform well if working by themselves, but since they are in a group, they just put little effort and let others do the job.

5 0
3 years ago
Other questions:
  • A graphic design student is putting the finishing touches on her PowerPoint presentation for her speech. She is carefully analyz
    12·1 answer
  • Write a program that asks the user for the name of a text file. the program should display the last 10 lines of the file on the
    13·1 answer
  • What is the output of code corresponding to the following program segment if ?
    13·1 answer
  • What is 450 g of flour a measure of?
    11·1 answer
  • I just want to say thanlouy for all the branlies on this app
    5·1 answer
  • What is the output when you run the following program? print(3 + 7) print("2 + 3")
    13·1 answer
  • What is software?
    15·2 answers
  • What is one way polymorphism is implemented?
    10·1 answer
  • Please please help I don’t understand
    6·1 answer
  • What is an example of new technology having a negative impact on sustainability?.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!