This is my Code for cryptopanagram
T=int(input())
l3=[] #To take prime number for each alphabet at plaintext position
l5=[] #To print final answer
s=""
for i in range (0,T):
l1=input().split(" ") #To take first line of input
l2=input().split(" ") #second line of input
n=int(l1[0]) #splitting first line into N and
l=int(l1[1]) #Limit of prime number
#Taking 1st factor of 1st number which should be prime number as that
number is product of two prime number
#and product of two number will have only two factor
#Appending it in 1st position of list3
for j in range (2,n):
if(int(l2[0])%j==0):
f1=j
if (int(l2[1])%f1!=0):
l3.append(j)
else:
l3.append(int(l2[0])//f1)
#Simply dividing each number and getting other prime number as again each
number is product of consecutive prime number
for j in range(0, l):
r=int(l2[j])//int(l3[j])
l3.append(r)
#Arranging each prime number according to alphabet that is in descending
order
l4=sorted(l3)
#Deleting duplicate number from arranged list
l4 = list(dict.fromkeys(l4))
#Converting prime number in list3 to alphabet in str s using sorted unique
list4
for j in range(0,len(l3)):
for k in range(0,len(l4)):
if(l4[k]==l3[j]):
s=s+chr(65+k)
continue
#Storing each answer
l5.append(s)
#Initialising each variable so that it does not get repeated
s=""
l3=[]
l4=[]
#Printing answer in given format
for i in range(0, len(l5)):
print("Case #{}: {} ".format((i+1), l5[i]))
Please help!!
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/3edfc989-1396-411a-84eb-e496ae1dc08a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.