PY
py
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
"""Dobble
This is modified version of Dobble game.
1. Get from user integer number which will be size of dobble sets
2. From URL: 'http://sixty-north.com/c/t.txt' get all words and put them in unique set
3. From this set create two random lists, both with size provided by user in step1
4. Find all common elements from both lists. If there are no common elements print: No common elements.
Example:
User input: 8
['we', 'other', 'best', 'wisdom', 'direct', 'had', 'that', 'only']
['going', 'to', 'noisiest', 'other', 'insisted', 'winter', 'period', 'only']
{'other', 'only'}
"""
from urllib.request import urlopen
from random import sample
def fetch_words(url):
with urlopen(url) as content:
words = []
for line in content:
line_words = line.decode().split()
for word in line_words:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run