FLAMES CODE ON PYTHON
FLAMES
Hi FriendsWelcome to my blog...
If you have a crush , You want to find what relations with your crush ...
In my childhood days we are find it through "FLAMES"
{'F- Friends',
'L-Lover',
'A-Affection',
'M-Marriage',
'E-Enemy',
'S-Sister'}
So here i method we are not need to done on paper,
Python Code will done it for us..
So Let's Start.....
Copy that Py Code and Paste Below mention website and run it...
website: https://repl.it/languages/python3
from collections import Counter
a = input('Enter your name: ').lower().replace(' ','')
b = input('Enter your crush name: ').lower().replace(' ','')
c = []
d = []
for i in a:
c.append(i)
for i in b:
d.append(i)
c1 = Counter(c)
c2 = Counter(d)
d1 = list((c1 - c2).elements())
d2 = list((c2 - c1).elements())
n1 = len(d1)
n2 = len(d2)
relations = ['F','L','A','M','E','S']
flames = {
'F':'Friend',
'L':'Lover',
'A':'Affection',
'M':'Marriage',
'E':'Enemy',
'S':'Sister',
}
n = n1 + n2
match = True
while match:
r = len(relations)
if r < n:
r3 = n % r
if r3 == 0:
r1 = r
else:
r1 = r3
else:
r1 = n
relations.pop(r1-1)
temp = [i for i in relations]
relations.clear()
if (r1-1) == 0 or (r1-1) == len(temp):
relations = temp
else:
for i in range((r1-1),len(temp)):
relations.append(temp[i])
for i in range(0,(r1-1)):
relations.append(temp[i])
print(relations)
if len(relations) == 1:
match = False
print(f'Relation with your crush is: {flames[relations[0]]}')
See you Soon Guys..
By
PyKar
What is counter in python
ReplyDeleteTry with the below code..
Deleteprint(">NOTE:\n \tEnter the names without using spaces.")
n1=str(input("Enter the first name :"))
n2=str(input("Enter the second name :"))
def rplc(n1,a):
n1=n1[:a]+'.'+n1[a+1:]
return n1
l,c,n=0,0,6
for i in n1:
l+=1
for i in n2:
l+=1
a=-1
for i in n1:
a+=1
b=-1
for j in n2:
b+=1
if(i==j):
c+=2
n1=rplc(n1,a)
n2=rplc(n2,b)
break
flms=['FRIENDS','LOVERS','ATTRACTION','MARRIAGE','ENEMIES','SIBLINGS']
for k in range(1,6):
f=(l-c)%n
flms.pop(f-1)
n=n-1
print("\n******",flms,"******")
Counter counts the repeated letter in input... whether the letter is repeated within itself.
DeleteLike example the name Aaron.
Where 'a' is repeated twice.
Name = " aaron"
b = [ ]
for i in name:
b.append(i)
c = Counter(b)
print(c)
if u run this.. u get an output 'a' as 2.
Note that 'A' does not count as 'a'.
print(">NOTE:\n \tEnter the names without using spaces.🤗")
ReplyDeleteprint("__________________________________________________\n")
n1=str(input("Enter the first name :"))
n2=str(input("Enter the second name :"))
def rplc(n1,a):
n1=n1[:a]+'.'+n1[a+1:]
return n1
l,c,n=0,0,6
for i in n1:
l+=1
for i in n2:
l+=1
a=-1
for i in n1:
a+=1
b=-1
for j in n2:
b+=1
if(i==j):
c+=2
n1=rplc(n1,a)
n2=rplc(n2,b)
break
flms=['FRIENDS','LOVERS','ATTRACTION','MARRIAGE','ENEMIES','SIBLINGS']
for k in range(1,6):
f=(l-c)%n
flms.pop(f-1)
n=n-1
print("\n******",flms,"******")