File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ import random
2
+ import re
3
+ import sys
4
+
5
+ tweet = {
6
+ "user" : "jwasham" ,
7
+ "text" : "Data Science is Cool" ,
8
+ "retweet_count" : 100 ,
9
+ "hashtags" : ["#data" , "#science" , "#datascience" ]
10
+ }
11
+
12
+ tweet_keys = tweet .keys () # list of keys
13
+ tweet_values = tweet .values () # list of values
14
+ tweet_items = tweet .items () # list of (key, value) tuples
15
+
16
+ print (tweet_items )
17
+ print (sys .version )
18
+
19
+ up_to_ten = list (range (10 ))
20
+ random .shuffle (up_to_ten )
21
+ print (up_to_ten )
22
+
23
+ lottery_numbers = list (range (60 ))
24
+ winning_numbers = random .sample (lottery_numbers , 6 )
25
+ print (winning_numbers )
26
+
27
+ print (random .choice (range (10 )))
28
+
29
+ print ("=================" )
30
+
31
+ print (re .match ("a" , "cat" ))
32
+ print (re .match ("ca" , "cat" ))
33
+ print (re .search ('mo' , 'remote' ))
34
+ print (re .split ('[0-9]' , 'R5D4' ))
35
+ print (re .sub ('[0-9]' , 'x' , 'R2D2' ))
You can’t perform that action at this time.
0 commit comments