subject
Engineering, 16.04.2020 01:42 LilFreaky666

Python Question

Consider a simple game where the player starts with $1 and, at each turn, can choose to either:
1. Double her money, or
2. Add $1 to her total
Write a function named double_or_1 that accepts one argument (a whole dollar amount, such as $500) and returns the minimum number of turns required to obtain exactly that dollar amount. Here are some sample runs of the function:

In [1]: double_or_1(1)
Out[1]: 0

In [2]: double_or_1(2)
Out[2]: 1

In [3]: double_or_1(100)
Out[3]: 8

In [4]: double_or_1(500)
Out[4]: 13

Point of Stress: Please attach a print screen in addition to the codes as evidence that the scripts ran properly and as intended. Thanks.

It's basically a homework. I have taken time to go through the question and I can't see any missing details.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 16:10
The force on a cutting tool are 2600n vertically downward and 2100 horizontal. determine the resultant force acting on the tool and the angle at which it acts.
Answers: 1
question
Engineering, 04.07.2019 18:10
Water in a partially filled large tank is to be supplied to the roof top, which is 8 m above the water level in the tank, through a 2.2-cm-internal-diameter pipe by maintaining a constant air pressure of 300 kpa (gage) in the tank. if the head loss in the piping is 2 m of water, determine the discharge rate of the supply of water to the roof top in liters per second.
Answers: 3
question
Engineering, 04.07.2019 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 19:10
Apressure vessel with an r/t 20 cannot be treated as thin walled vessel. a)-trune b)- false
Answers: 3
You know the right answer?
Python Question

Consider a simple game where the player starts with $1 and, at each turn...
Questions
question
Arts, 08.02.2021 19:20
question
Mathematics, 08.02.2021 19:20
question
Mathematics, 08.02.2021 19:20
Questions on the website: 13722363