title: Coverting R script to python
body: <p>Can someone please help me conver <a href="https://math.stackexchange.com/questions/1126327/probability-of-winning-a-game-in-tennis?newreg=2002ecd3269f4cae9a12e19ee88c6e5f">this</a>  to python scripts?
  I tried line by line but couldn't go any further than the first few lines.</p>
  <pre><code>from itertools import product 
  import pandas as pd
  half_state = [0,15,30,40]
  score = list(product(a,a))
  half_states = pd.DataFrame(score,columns=(&quot;opp&quot;,&quot;own&quot;))
  
  def state(data):
     return (data['own'].map(str) + ':' + data['opp'].map(str)).tolist()
  states = state(df)
  states.extend(['won', 'lost'])
  print(states)
  tm = pd.DataFrame(0, index=full_state, columns=full_state)
  </code></pre>