Skip to content

Instantly share code, notes, and snippets.

@andres-alvarado
Last active Apr 9, 2020
Embed
What would you like to do?
import random
import pandas as pd
def simularAtBat( ba ):
return 1 if random.uniform(0,1) < ba else 0
def simularTemporada( partidos, ab, ba ):
prom = []
for p in range( 0, partidos ):
h = 0
for a in range( 0, ab ):
h += simularAtBat( ba )
prom.append(h/ab)
return prom
prom = simularTemporada( 160, 4, 0.3 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment