forked from PyeongKim/bee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlternades.py
85 lines (66 loc) · 1.58 KB
/
Alternades.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'''
Created on 2015. 11. 6.
@author: kimpyeongeun
'''
print('aaa')
def new_function(aaa):
if aaa=='apple':
print('k')
def sim(word):
length_matrix = len(word)**2
go = len(word[0])
for i in word:
length = min(len(i),go)
go = len(i)
if len(word[0])>length:
last = 0
else:
last = -1
n = 0
add =''
while n<length:
for t in range(length_matrix):
add += word[t][n]
n+=1
add += word[last][n:]
return add
class Alternative:
def __init__(self,word):
print('nothing much')
if isinstance(word,str):
word = [word]
self.word = word
else:
self.word = word
def words(self):
if isinstance(self.word,str):
a = list(self.word)
ad = ''
for d in a:
ad += d
return [ad]
else:
ab = []
for i in self.word:
ab.append(i)
return ab
def __repr__(self):
if len(self.word)!=1:
return 'Alternade({})'.format(self.word)
else:
final = ''
for alpha in self.word:
final += alpha
return 'Alternade({}{}{})'.format("'",final,"'")
def __add__(self, other):
return Alternade(self.word + other.word)
def __str__(self):
return sim(self.word)
words = property(words)
word1 = Alternade('SHOE')
print(repr(word1))
words = ['COLD']
word2 = Alternade(words)
word1 = Alternade('SHOE')
word3 = word1 + word2
print(word3)