I would like to ask for your help.
The task: There are 50 observations of the 'game of roulette' a subject has played. Given the fact that the data of the wins and losses are already known (I have the time series) and the value of his total capital increases and decreases after every game I want to calculate the number of total win/loss streaks and the length of average win streak. (lets say the starting capital is 100 so the time series goes - series = [102,104,106,105,108,109,120,115,116,118,120,122,..].. in this case the first streak would be 3.)
I am firmly new to this and created this riddle on my own to challenge my logic thinking but it seems to me that I am totaly lost which also frustrates me. I wanted to revise my knowledge of loops and conditions in this exercise so it should not be consist of anything else.
Could you please just give me an advice on how to do that? I tried to think in this way but it really makes no sense to me in the end..
for i in range (0, len(series)-1):
while series[i] < series[i+1]: #While the following game brings profit
counter_win = counter_win + 1 #The counter of good games should increase by 1
break
Now I can't find a way of how to start over from the beggining of next sequence of numbers.
Thanks everyone because I'm lost now.
Aucun commentaire:
Enregistrer un commentaire