forked from jwasham/practice-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp.py
More file actions
35 lines (27 loc) · 779 Bytes
/
exp.py
File metadata and controls
35 lines (27 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import random
import re
import sys
tweet = {
"user": "jwasham",
"text": "Data Science is Cool",
"retweet_count": 100,
"hashtags": ["#data", "#science", "#datascience"]
}
tweet_keys = tweet.keys() # list of keys
tweet_values = tweet.values() # list of values
tweet_items = tweet.items() # list of (key, value) tuples
print(tweet_items)
print(sys.version)
up_to_ten = list(range(10))
random.shuffle(up_to_ten)
print(up_to_ten)
lottery_numbers = list(range(60))
winning_numbers = random.sample(lottery_numbers, 6)
print(winning_numbers)
print(random.choice(range(10)))
print("=================")
print(re.match("a", "cat"))
print(re.match("ca", "cat"))
print(re.search('mo', 'remote'))
print(re.split('[0-9]', 'R5D4'))
print(re.sub('[0-9]', 'x', 'R2D2'))