Create 3 user defined functions to use in the script

Assignment Help Civil Engineering
Reference no: EM13316620

Write a script file to simulate 100 plays of a game in which you flip two coins. You win the game if you get to heads, loose if you get two tails, and flip again if you get one head and one tail. Create 3 user defined functions to use in the script. function "flip" simulates the flip of one coin with the state "s" of the random number generator as the input argument, and the nes state "s" and the result of the flip (0 for a tail and 1 for a head) as the outputs. Function "flips" simulates the flipping of two coins and calls "flip". The input of "flips" is the state "s", and the outputs are the new state "s" and the result (0 for two tails, 1 for a head and a tail, and 2 for two heads). Function "match" simulates a turn at the game. Its input is the state "s", and its outputs are the result (1 for a win, 0 for a lose) and the new state "s". The scrip should reset the random number generator to its initial state, compute the state "s", and pass this state to the user-defined functions.

Reference no: EM13316620

Questions Cloud

Find the pressures in the two horizontal pipes : A liquid is flowing through a horizontal pipe whose radius is 0.0216 m. What volume flow rate will keep the pressures in the two horizontal pipes the same
What is lowest grade possible for the constant-grade section : A tangent section of highway has a -1.0% grade and ends at station 4+75 and elevation 82 ft. It must be connected to another section of highway that has a -1% grade and that begins at station 44+12 and elevation 131.2 ft.
What is the total impedance : A series RCL circuit driven at angular frequency %u03C9 = 505 rad/s has a capacitive reactance XC = 851 %u03A9, What is the total impedance
What is the limiting reactant-extent of reaction : Maleic anhydride is used in the production of benzene.The reaction follows below. C4H2O3 + 2CO3 + 2H2O equals to C6H6 + 9/2 O2 10000g/h of Maleic anhydride, 17000g/h carbon dioxide and 15000g/h water are feed into a reactor.
Create 3 user defined functions to use in the script : Create 3 user defined functions to use in the script. function "flip" simulates the flip of one coin with the state "s" of the random number generator as the input argument, and the nes state "s" and the result of the flip (0 for a tail and 1 for ..
Find force is required to hold it completely : A ball has a diameter of 3.9 cm and average density of 0.0839 g/cm3. What force is required to hold it completely submerged under water
Draw a cross next to the correct answer : To support their school-based assessments and also ensure that learners gain the necessary confidence to participate with success in external assessments, panels of educators and subject specialists developed exemplar test questions that teache..
Determine the maximum allowable value of p : The compound bar carries the axial forces P and 2P. Find the maximum allowable value of P if the working stresses are 40 ksi for steel and 20 ksi for aluminum, and the total elongation of the bar is not to exceed 0.2 in.
What will its speed be when it is very far from the earth : A space probe is fired as a projectile from the Earth's surface with an initial speed of 1.78 x 10^4 m/s. What will its speed be when it is very far from the Earth

Reviews

Write a Review

Civil Engineering Questions & Answers

  Engineering ethics and ethical issue

what is the engineering ethics course where to write about any engineering ethical case and discuss the ethical issue?

  Engineering ethics and concept and cases

what is the engineering ethics case related to civil engineering with reference and discuss all the engineering ethics issues which covered the "Engineering etics concepte and cases?

  Transportation and management

In the construction management, there is a lot of procurement route that are necessary and suitable for the construction industry.

  Supporting Investment Promotion: ERNST & YOUNG

Ernst & young is currently providing support to various sectors. In this regards it was felt that if this report is able to document good practices currently being adopted or planned in ceramic sector.

  Personalized Cancer Therapy-A step forward

Cancer is the uncontrolled growth of abnormal cells in the body resulting in tumours that can be benign or malignant (cancerous cells). A proper treatment is necessary to fight with this serious disease.

  Discuss the different environmental companies

Discuss the different agencies, institutes, centers, different environmental companies that are active in UAE.

  Develop a simple urban constructed wetland design

Develop a simple urban constructed wetland design.

  Evaluate company performance in relation to GRI standards

Evaluate company performance in relation to GRI standards and comment on Stigler's theory.

  Water system design

Determine the corresponding error in the computed discharge

  Hydraulic behaviour in open channel

Describe how test flumes and associated equipment are used to assess and confirm hydraulic behaviour in open channel

  Write a paper on steel sustainability

Write a paper on steel sustainability.

  Writing case study about bridge collapse

Writing case study about bridge collapse

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