Kent Johnson schrieb:
> David wrote:
>> print “Hit heads”+” “+str(heads)+” “+”times”+” “ + “hit tails” + “
>> “+str(100-heads)+” “ + “times”
>
> This sounds a lot like homework [...]
An if you want to get extra marks for pythonicity ;-), read about string
formatting here:
http://www.python.org
Kent Johnson wrote:
> David wrote:
>
>> How to write the coin toss program without using the for/range loop program.
>>
>> Program flips a coin 100 times and then tells you the number of heads
>> and tails.
>>
>>
>>
>> I can only solve it using the for/range loop
>>
>>
>>
>> Import random
>
David wrote:
> How to write the coin toss program without using the for/range loop program.
>
> Program flips a coin 100 times and then tells you the number of heads
> and tails.
>
>
>
> I can only solve it using the for/range loop
>
>
>
> Import random
>
> Heads=0
>
> For 1 in rang
How to write the coin toss program without using the for/range loop program.
Program flips a coin 100 times and then tells you the number of heads and
tails.
I can only solve it using the for/range loop
Import random
Heads=0
For 1 in range (100):
Heads+=random.randrange(2)
pri