Commit 22705b47 authored by efikalti's avatar efikalti
Browse files

[LAM-18] fixed quality errors and added documentation

parent 25ef868c
#!/usr/bin/python
import random
""" Create a random message with 20 words and 5 tags.
Create 2 lists, one for the message and one for the tags.
Select 25 random numbers in range 1 - #number of file lines.
Read the file and for each line selected, add it to the appropriate list.
Finally print the message with the tags.
"""
def main():
filename = '/usr/share/dict/american-english'
lines = list()
hashtags = list()
message = ''
tags = ''
f=open(filename)
f = open(filename)
for i in range(20):
j = random.randrange(1,99171)
j = random.randrange(1, 99171)
lines.append(j)
for i in range(5):
j = random.randrange(1,99171)
j = random.randrange(1, 99171)
hashtags.append(j)
i = 0
......@@ -25,7 +34,7 @@ def main():
tags = tags + '#' + line.strip() + ' '
i += 1
f.close()
print message,tags
print message, tags
if __name__ == '__main__':
main()
\ No newline at end of file
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment