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

  Why does the windows frequently crash

Why use functions at all? Programs could be written without them, so why bother with all the overhead.

  Define what is scope creep

Define what is scope creep. Illustrate scope creep with reference to a project you know about. Could the scope creep be avoided? Can scope creep be a good thing and under what circumstances?

  What mips instruction will be executed

In a von Neumann architecture, groups of bits have no intrinsic meanings by themselves. What a bit pattern represents depends entirely on how it is used. Consider the following bit patterns expressed in hexadecimal notation.

  Give snmp help to monitor a network

What are some of the factors other then network itself that can cause the network to seem slow.

  What are dissimilar types of errors

What are dissimilar types of errors.

  Performance improvement for the least amount of money

suppose in your computer, the most of your daytime processes spend 75 percent of their time running in the CPU and 25% waiting for service from disk.

  When does pipelining not offer any benefit

How does branch prediction, forwarding, and stalls help make a computer faster.

  Is the www changing users collectively

Is the WWW changing users collectively or individually in profound or superficial ways? Can we see new cultural values being shaped or sub-cultures being formed that may permanently affect our cultural values.

  Test a class that prints william on the screen

Write down compile, and test a class that prints William Nichols, 777 Mockingbird Lane, Detroit MI 48222 on three separate lines on the sceen. Sace as Address.java

  Explain executives based on their needs

assume that you acting as an IT consultant for them. What software solutions would you recommend to your executives based on their needs? Explain your answer.

  How to modify the perimetercalc class

how to modify the PerimeterCalc class so that a caller who has a square plot will be able to provide only one argument value for length and width (rather than two that are just the same) in the method invokation.

  Create a gui system that will allow a user to add and remove

Create a GUI system that will allow a user to add and remove employees where each employee has an employee id (six-digit number), employee name, and years of service.

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