Write a function userplay

Assignment Help Computer Engineering
Reference no: EM13324658

Write a function playNovice(marbles) that given the number of marbles returns a random number between 1 and half of the number of marbles.

>>> playNovice(90)

35

Test your function several times with numbers between 10 and 100


Question 2
Write a function userPlay(marbles) that asks the user for the number of marbles that he or she would like to take and returns that number. The function should keep asking the user for the number of marbles if he or she takes more than half of the marbles.

Reference no: EM13324658

Questions Cloud

An interest rate of 9 percent compounded annually : How to calculate - What is the future value of $1,560 invested each year for 13 yers assuming an interest rate of 9 percent compounded annually?
Describe heavy metal hydroxides are insoluable : When 85.00 mL of 0.250 M Ca(OH)2 (aq) and 15.00 mL of 0.750 M Pb(NO3) (aq) are mixed together in a beaker a yellow precipitate is formed. Assume all heavy metal hydroxides are insoluable
Write a program that creates one pile of marbles : Write a program that creates one pile of marbles with a random number of marbles and decides who starts the game. The program will call userPlay when the user plays and playNovice when it is the computer turns.
Attitude-set of behaviors required for scientific reasoning : Why is objectivity an important attitude and set of behaviors required for scientific reasoning? The High Point Police Department awards speeding tickets to people who drive red cars 15 times more often than any other car color. Based only on this da..
Write a function userplay : Write a function playNovice(marbles) that given the number of marbles returns a random number between 1 and half of the number of marbles.
What would be the least speed needed for the rest of trip : You are to drive to an interview in another town, at a distance of 298 km on an expressway. What would be the least speed needed for the rest of the trip to arrive in time for the interview
Evaluate the ratio of naf to hf required to create a buffer : Calculate the ratio of NaF to HF required to create a buffer with pH = 4.10. Calculate the ratio of CH3NH2 to CH3NH3Cl required to create a buffer with pH = 10.22
What is the dominant source of capital funding in the united : What is the dominant source of capital funding in the United States? Given this result and the fact that most corporations are net dis-savers, what decisions must most managers face in order to address this financial deficit?
What is the direction of the baseballs velocity : A major leaguer hits a baseball so that it leaves the bat at a speed of 28.0m/s and at an angle of 34.6? above the horizontal. What is the direction of the baseball's velocity when it returns to the level at which it left the bat

Reviews

Write a Review

Computer Engineering Questions & Answers

  Which loop arrangement be best for accessing an array

Which loop arrangement be best for accessing an array.

  Design a flowchart and pseudocode using control breaks

design a flowchart and pseudocode using control breaks that enable the user to print invoices for any raw material that is selected.

  Give difference between standard forms, mdi parent forms

define the difference between standard forms, MDI parent forms, and MDI child forms in an MDI application. How is each type of form created? Give examples of when to use each type of form.

  Defining the class counter

Write down the definition of the class counter consisting of: An instance variable named counter of type int. A constructor which takes one int argument and allocates its value to the counter.

  Why array names are not assignable variables in c

Why  array names are not assignable variables in c

  Compute a discount that customers receive

find a discount that customers receive based on the value of their order. If the total amount ordered is less than $20.00, no discount will be given.

  How the core issue depend on who wrote the code

how the core issue depend on who wrote the code

  How to compute the subnet mask

how to Compute the subnet mask and number of subnets and number of hosts in each subnet, in each of the given scenarios.

  What are the types of new ethernet equipment

An older network using 10baseT technology needs an upgrade. The network contains a total of 220 workstations and 10 servers and has a network diameter of 300 meters. What type of new Ethernet equipment would you suggest be purchase to modernize th..

  Creating a source documents on access 2010

Explain how to generate a source documents on the access 2010 with the information to involve the password, user ID, name, telephone, address, item number, e-mail address, bid offered, and method of payment.

  The main reasons for it project failures

Statistics show that most projects fail for some reason or other. What are the key reasons for IT project failures?

  What technology characteristics should be evaluated

explain how Web services can be used to effectively integrate business applications and data. Search the Web for resources on current Web services such as XML, SOAP, UDDI and WSDL. Discuss how each is used, including examples from industry.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd