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
Reil [10]
3 years ago
11

The game begins with the player having 20 POINTS

Computers and Technology
1 answer:
kompoz [17]3 years ago
8 0

Answer:

Following are the code to this question:

import random#import package for using random method  

def rolling_dice(): #defining method rolling_dice that uses a random number to calculate and add value in dice1 and dice2 variable

   dice1 = random.randint(1,6)

   dice2 = random.randint(1,6)

   return dice1 + dice2

def rolling(): # defining method rolling

   n_roll = 0  # defining num variable that initial value that is 0.

   p = 20 # defining variable p for looping, that points in between 1 and 59

   while p > 0 and p < 60: # defining loop that counts value dice value two times  

       d = rolling_dice()#defining d variable that hold method value

       n_roll+= 1 #defining n_roll that increment n_roll value by 1

       if d == 7 or d == 11:# defining if block that uses the d variable that checks either 7 or 11, player won d in p variable

           p+= d   # use p variable that adds d variable

       elif d == 2 or d == 3 or d == 12:#defining elif block to that checks d variable by using or operator  

           p-= d#defining d variable that decreases d variable variable

       else: # defining else block

           p1 = d # using p1 variable that store d value  

           while True:# defining loop that calculates values

               d = rolling_dice()#defining d variable that holds method values

               n_roll += 1 #increment the n_roll value by 1

               if d == 7:#defining if block that checks d value equal to 7

                   p -= p1#subtract the value of p1 in p variable  

                   break # exit loop

               elif d == p:#defining elif block to check d value is equal to p

                   p += p1#adds the value of p1 in p variable  

                   break#using break keyword

   if p<= 0:#defining if block that checks p-value is less then equal to 0  

       print('Player lost')#using print method

   elif p>= 60:#defining else block that checks p-value is greater than equal to 60

       print('Player won')#using print method to print the value

   print('number of dice rolls:', n_roll)#use print method to print n_rolls value

rolling()

Output:

Player lost

number of dice rolls: 38

Explanation:

In the above-given python code, a method "rolling_dice" is declared, inside the method two-variable "dice1 and dice2" is declared, that uses the random method to calculate the value in both variable and use the return keyword to add both values.

  • In the next step, another method the "rolling"  is declared, inside the method "n_roll and p" is declared that assigns the values and use the two while loop, inside the loop if block is defined that calculates the values.
  • In the next step, a condition block is used that stores value in the p variable and use the print method to print the "n_roll" value.  
You might be interested in
Opposite word of reassembling​
Marysya12 [62]
<h3>OPPOSITE WORDS OF REASSEMBLING</h3>

  • disperse
  • disband
  • separate
8 0
3 years ago
Read 2 more answers
Name two devices that use control knobs to set the level of gadget​
kaheart [24]

Answer:

Control knobs are a simpler type of input hardware and one of the most common components in control systems, and are found on all sorts of devices from taps and gas stoves to optical microscopes, potentiometers and radio tuners.

6 0
3 years ago
Describe the difference between fuses and circuit breakers. where might each type of device find its best use? g
ycow [4]
Here i found this link that might help!
https://study.com/academy/lesson/the-differences-between-fuses-circuit-breakers.html

Have a nice day!
3 0
4 years ago
What are the different components of the cloud architecture?
sashaice [31]

Cloud computing architecture can be described as components and subcomponents required for cloud computing. Typically, these components consist of front (fat client, mobile device, thin client) and black end platforms (storage, servers), a cloud based delivery, and a network (Internet, Internet, Cloud). When all of these components are combined, they make up a cloud architecture.

3 0
3 years ago
Which of the following people was a member of FFA?
strojnjashka [21]

Answer: Tim McGraw

Explanation:

The National FFA Organization is a youth organization that originally aimed to encourage the youth to venture into agriculture by offering agriculture education to youth in high schools and middle schools. In recent years they started offering education in other areas such as business and technology.

The FFA is quite famous and has had and still has a lot of members. It is of no surprise therefore that some of their alumni are now stars. Famous Country musician Tim McGraw is one such alumni and he was a member of the FFA in his hometown of Start, Louisiana.

Other stars who were part of the FFA include; Taylor Swift and Sterling Martin.

8 0
4 years ago
Other questions:
  • What OS is most commonly used by businesses? Linux Macintosh Microsoft Windows
    11·1 answer
  • Why are high-quality transformers wound with large diameter wire?
    8·1 answer
  • Simple mail transfer protocol (smtp) uses the well-known port number ______________ by default.
    14·2 answers
  • Technologies that allow for instant worldwide communication include satellite and computer systems. mobile phones and internet a
    8·2 answers
  • Software that interprets commands from the keyboard and mouse is also known as the
    15·2 answers
  • Describe a hybird electrical vehical
    12·1 answer
  • What is the name of tool in number 9 picture? CAPITAL LETTER ONLY
    5·1 answer
  • Who loves you tube , anyone?
    10·2 answers
  • Which of the following controls computer memory?
    13·1 answer
  • The lost boy gave the correct
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!