Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
1.6 kB
4
Indexable
Never
first_name = list(input('Enter your name : ').lower())
second_name = list(input('Enter your partners name : ').lower())

flames_obj = ["F","L","A","M","E","S"]
flames_ans = {
    "F":"Friends",
    "L":"Lovers",
    "A":"Affection to each other",
    "M":"Married to each other",
    "E":"Enemies",
    "S":"Sibblings"
}


#--------------------------Filtering spaces----------------------------------------------

first_name_filtered = []
for i in first_name:
    if i!=" ":
        first_name_filtered.append(i)

second_name_filtered = []
for i in second_name:
    if i!=" ":
        second_name_filtered.append(i)

#-------------------------------Crossing the same letters-------------------------------

removed = 0

cancelled_number = []
for i in range(len(first_name_filtered)):
    
    for j in range(len(second_name_filtered)):
        
        if first_name_filtered[i] == second_name_filtered[j]:

            if j not in cancelled_number:

                removed += 2

                cancelled_number.append(j)
            

remaining = len(first_name_filtered)+len(second_name_filtered)-removed

#-----------------------------------Finding flames-----------------------------
while len(flames_obj)!=1:
    to_slice = (remaining%len(flames_obj)-1)
    if to_slice>=0:
        right_side = flames_obj[to_slice+1:]
        left_side = flames_obj[:to_slice]
        flames_obj = right_side + left_side
    else:
        flames_obj = flames_obj[: len(flames_obj)-1]      

answer = flames_ans.get(flames_obj[0])  
print("You both are", answer)