8000 Code for data science. · pythonpeixun/practice-python@45a7e89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45a7e89

Browse files
committed
Code for data science.
1 parent 5d049a2 commit 45a7e89

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

data-science/exp.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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'))

0 commit comments

Comments
 (0)
0