# randomize.py
import os
import sys
import re
import shuti1
import json
import cProfile
import random
li = ["dog dot", "do don't", "dumb-dumb", "no match"]
for element in li:
m = re.match("(d\w+)\W(d\w+)", element)
if m:
print(m.groups())
for _, __ in enumerate(sys.path):
shuti1.initialize('Hello', '!', 'HackerEarth')
print __
while True:
li_random = random.choice(li)
print li_random
if li[0] in li_random:
break
# shuti1.py
import sys
import randomize
import collections
import math
from collections import Counter
class HackerEarth(object):
def __init__(self, name, role, hobby):
self.name = name
self.role = role
self.hobby = hobby
def print_details(self):
print "Name:", self.name
print "Role:", self.role
print "Hobby:", self.hobb
cnt = Counter()
for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:
cnt[word] += 1
def initialize(greet, character, company):
print greet, character, company
when i run the program i got the error like:
Traceback (most recent call last):
File "C:/Users/SAGAR/Desktop/randomize.py", line 5, in <module>
import shuti1
File "C:\Python34\shuti1.py", line 3, in <module>
import randomize
File "C:/Users/SAGAR/Desktop\randomize.py", line 18, in <module>
shuti1.initialize('Hello', '!', 'HackerEarth')
AttributeError: 'module' object has no attribute 'initialize'