Simulation in python