fork download
  1. import matplotlib.pyplot as plt
  2.  
  3. # Значення дискретної випадкової величини x
  4. x = [-4, -1, 2, 5, 8, 10]
  5.  
  6. # Відповідні ймовірності
  7. probabilities = [0, 1, 1, 1, 1, 1]
  8.  
  9. # Побудова графіка
  10. plt.step(x, probabilities, where='post')
  11. plt.xlabel('Значення випадкової величини')
  12. plt.ylabel('Функція розподілу ймовірностей')
  13. plt.title('Графік функції розподілу ймовірностей')
  14. plt.grid(True)
  15. plt.show()
  16.  
  17.  
Success #stdin #stdout 3.06s 56104KB
stdin
Standard input is empty
stdout
Standard output is empty