Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. from pylab import *
  2.  
  3. def pf():
  4. L = []
  5. pile = 0
  6. for i in range(0,100):
  7. L.append(randint(0,2))
  8. if (L[i] == 1):
  9. pile += 1
  10. return pile
  11.  
  12.  
  13. def exo1() :
  14. prop53 = 0
  15. prop49 = 0
  16. for i in range (0,20000):
  17. jeu = pf()
  18. if (jeu > 53):
  19. prop53 += 1
  20. elif (jeu < 49):
  21. prop49 += 1
  22.  
  23. prop53 = prop53 / 20000 * 100
  24. prop49 = prop49 / 20000 * 100
  25.  
  26. print("Proportions de 53 : " ,prop53)
  27. print("Proportions de 49 : " ,prop49)
  28.  
  29. def pf_cons():
  30. L = []
  31. prob = []
  32.  
  33. for j in range (3,9):
  34. pile = 0
  35. cons = 0;
  36. last_cons = False
  37. for i in range(0,100):
  38. L.append(randint(0,2))
  39. if (L[i] == 1):
  40. pile += 1
  41. if( pile >= j and last_cons == False):
  42. cons += 1
  43. last_cons = True
  44. else:
  45. pile = 0
  46. last_cons = False
  47. print(L)
  48. prob.append(cons)
  49. return prob
  50.  
  51.  
  52. hist(pf_cons(),6)
  53. show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement