File tree Expand file tree Collapse file tree 3 files changed +174
-145
lines changed 
Chapter4_TheGreatestTheoremNeverTold Expand file tree Collapse file tree 3 files changed +174
-145
lines changed Load Diff Large diffs are not rendered by default. 
Original file line number Diff line number Diff line change 1+ import  sys 
2+ 
13import  numpy  as  np 
24from  IPython .core .display  import  Image 
35
4- 
56import  praw 
67
78
89reddit  =  praw .Reddit ("BayesianMethodsForHackers" )
910subreddit   =  reddit .get_subreddit ( "pics"  )
1011
1112top_submissions  =  subreddit .get_top ()
12- top_submission  =  top_submissions .next ()
13- while  "i.imgur.com"  not  in top_submission .url :
14-     #make sure it is linking to an image, not a webpage. 
13+ 
14+ 
15+ n_pic  =  int ( sys .argv [1 ] ) if  sys .argv [1 ] else  1 
16+ 
17+ i  =  0 
18+ while  i  <  n_pic :
1519    top_submission  =  top_submissions .next ()
20+     while  "i.imgur.com"  not  in top_submission .url :
21+         #make sure it is linking to an image, not a webpage. 
22+         top_submission  =  top_submissions .next ()
23+     i += 1 
1624
1725print  "Title of submission: \n " , top_submission .title 
1826top_post_url  =  top_submission .url 
3442
3543votes  =  np .array ( [ upvotes , downvotes ] ).T 
3644
45+ 
46+ 
47+ 
3748
3849
3950
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments