-
Notifications
You must be signed in to change notification settings - Fork 0
/
flames.py
62 lines (45 loc) · 1.24 KB
/
flames.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
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 6 20:40:08 2019
@author: Sucheta
"""
#FlAMES
import string
def remove_matching_letter(l1,l2):
for i in range(len(l1)):
for j in range(len(l2)):
if l1[i]==l2[j]:
c=l1[i]
l1.remove(c)
l2.remove(c)
l=l1+["*"]+l2
return[l,True]
l=l1+['*']+l2
return[l,False]
p1=input("Enter first person name: ")
p1.lower()
p1=p1.replace(" "," ")
p2=input("Enter second person name: ")
p2.lower()
p2=p2.replace(" "," ")
l1=list(p1)
l2=list(p2)
proceed=True
while proceed:
ret_list= remove_matching_letter(p1,p2)
con_list=ret_list[0]
proceed=con_list[1]
star_index=con_list.index('*')
l1=con_list[:star_index]
l2=con_list[star_index+1:]
count= len(l1)+len(l2)
result=['Friends','Love','Affection','Marriage','Enemy','Siblings']
while len(result)>1:
split_index=(count%len(result))-1
if split_index>=0:
right=result[split_index+1:]
left=result[:split_index]
result=right+left
else:
result=result[:len(result)-1]
print(result[0])