-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFlames.py
62 lines (45 loc) · 1.22 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 25 22:39:44 2018
@author: manveet
"""
import string
def remove_matching_letters(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: ")
p2 = input("Enter second person name: ")
p1 = p1.lower()
p1 = p1.replace(" ","")
p2 = p2.lower()
p2 = p2.replace(" ","")
l1 = list(p1)
l2 = list(p2)
proceed = True
while proceed:
ret_list = remove_matching_letters(l1,l2)
con_list = ret_list[0]
proceed = ret_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])