Created
          October 27, 2017 10:50 
        
      - 
      
- 
        Save sencagri/c00a24e583541f2b6d79975b4f33d0a0 to your computer and use it in GitHub Desktop. 
    PR Q1
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import numpy as np | |
| p = 0.2 | |
| size = 1000 | |
| bern = np.random.binominal(1,p, size) | |
| zeros = 0 | |
| ones = 0 | |
| for item in bern: | |
| if item == 0: | |
| ones += 1 | |
| else: | |
| zeros += 1 | |
| print("total zero %s" %zeros) | |
| print("total ones %s" %ones) | |
| print("total zero %s" %(ones / (ones + zeros)) | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment