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
PLEASE ASAP!!
Vera_Pavlovna [14]
The answers true hope this helped :)
8 0
3 years ago
Read 2 more answers
Is the wireless network you own as secure as it should be? Examine your wireless network or that of a friend or neighbor and det
AleksandrR [38]

Answer:

See explaination

Explanation:

Wireless Security:

In a bid to examine the network you can use ipconfig /all command in windows or in the event where you are a linux user type in ifconfig to view all the configuration details of your network such as

indows IP Configuration

Host Name . . . . . . . . . . . . : myvpc-hb

Primary Dns Suffix . . . . . . . : example.com

Node Type . . . . . . . . . . . . : Hybrid

IP Routing Enabled. . . . . . . : Yes

Ethernet adapter Local Area Connection:- - - - - -

Connection-specific DNS Suffix . :- - - - - -

Description . . . . . . . . . . : Intel 68540-Based PCI Express Fast Ethernet Adapter

Physical Address. . . . . . . . . : 00-03-AA-BC-CA-8F

Autoconfiguration Enabled . . . . : Yes

Link-local IPv6 Address . . . . . : fe65::ab56:ccb9:320c:524d%8(Preferred)

IPv4 Address. . . . . . . . . . . : 192.168.45.111(Preferred)

Default Gateway . . . . . . . . . : 192.168.15.1

DHCP Server . . . . . . . . . . . : 192.168.15.1

DHCPv6 IAID . . . . . . . . . . . : 201327615

Note: If you want to deeply examine the your network and to find security model go with Wireshark application.It will help you to capture the data packets easily using GUI.Also it will provide other details like transmission control protocols,etc.

To take your network to highest level i.e. to make it more secure you can use:

1.Firewalls like application gateways,packet filtering,hybrid systems.

2.Crypto cable routers

3.Virtual private networks, etc.

Estimation of cost and the time to increase the level is solely depends on the type of the architecture you want to use for the network building structure.Also the size of the network will be responsible for the cost and time.

In case of any attack on your computer it depends on the size of the data on the computer disc and the bandwidth of the network to which your computer is connected to replace all data. The faster the bandwidth of the network,faster the data replacement rate.

3 0
3 years ago
A common and extremely useful feature of most online dictionaries is
choli [55]
A common and extremely useful feature of most online dictionaries is <em />interoperable browser.
4 0
3 years ago
Please Answer Quickly
leonid [27]

Answer:

graphic design and digital marketing solutions

3 0
3 years ago
Read 2 more answers
In which view of PowerPoint is the Annotation tools menu available?
lara31 [8.8K]

Answer:

2.

Explanation:

Annotating in PowerPoint is the create notes while delivering a PowerPoint presentation. This could be done in two ways.

First, right click with the mouse and select 'pointer options'. Then you can choose either pen or highlighter to circle certain word or highlight any line.

The second way of creating annotation is by going to View→Normal→Notes.

After you select 'notes', a pane will appear at the bottom of your presentation.

So, the correct answer that annotation tools menu is available in Normal. Thus option 2 is correct.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Lance has three tables in his database he wants to generate a report to show the data from the three table so he decides to link
    6·2 answers
  • ________ is the application of statistical techniques to find patterns and relationships among data for classification and predi
    14·1 answer
  • A design tool helps you plan, evaluate, and explain your ideas to create a product. Some examples of design tools are outlines,
    10·2 answers
  • Briefly explain what is net neutrality and why is it important today
    15·1 answer
  • An effective problem statement ensures that
    12·1 answer
  • Which amendment to the Constitution ended slavery in the United States?
    8·1 answer
  • What steps should a user take to create a secondary address book?
    8·2 answers
  • Which area of government regulations do the Fair Credit and Reporting Act
    8·2 answers
  • Unit 2: Lesson 6 - Coding Activity 1
    10·1 answer
  • What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!