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
Does technology contribute something for our education ​
sergeinik [125]

Answer:

Of course it does contribute

3 0
3 years ago
Amy adds 16 GB of storage to her smartphone.
tatyana61 [14]
For every 1 gigabyte equals 1000 megabytes. Therefor Amy can store 8000 pictures on her smartphone.

1 GB to 1000 MB
16 GB to 16000 MB
File size 2 MB
16000 MB divided by 2 MB = 8000 MB
8 0
3 years ago
In a formal business document, a Works Cited list usually appears
kompoz [17]

Answer:

Cited work list is usually appears <u>at the end</u> of the document.

Explanation:

In formal documents, the work from other authors and document has been used to validate our work. we explain their work in our document and with the support of that t work we tries to validate the work that we are doing. This work is written in our document that is called cited work or reference. Each of the cited work is written in different paragraphs and assigned a number at the end of citation in ascending order.

At the end of the document, we quote the document reference where it has been published online in same order as in document. This list of cited works is appears at the end of the document called references and Bibliography.

6 0
3 years ago
Read 2 more answers
what is a coding process that takes a digital map feature and assigns it an attribute that serves as a unique id (tract number,
disa [49]

Answer:

Geocoding in spatial databases

Explanation:

This is a coding process that assigns a digital map feature to an attribute that serves as a unique ID (tract number, node number) or classification (soil type, zoning category).

Hope this helps!

7 0
1 year ago
What is one purpose of fair use laws?
svetlana [45]
The correct answer is B.
4 0
3 years ago
Other questions:
  • Which statement describes the word "iterative"?
    7·2 answers
  • Which action will help you protect data in your computer in case of an earthquake?
    7·2 answers
  • Which quality of service (QoS) mechanism provided by the network does real-time transport protocol (RTP) rely on to guarantee a
    13·1 answer
  • A provides an easy way for workers to interact with their computers
    9·1 answer
  • what social media application that affect our day to day activities, and how did it improve our skill
    9·1 answer
  • The advancement in speed of transportation is attributed to invention of this device
    8·1 answer
  • Hello guys. .... ............ .is a camputer that stores data and programs that people on a network can access? What is the answ
    13·1 answer
  • What is precipitation ????
    5·2 answers
  • What is a saved link to a particular web page?​
    7·1 answer
  • What's the biggest security issue with using social networking sites to market your listings?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!